PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How to structure an application.
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How to structure an application.
![]() |
How to structure an application. |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
If you have a Windows Forms application, how do you divide up the logic among the presentation, business and data access layer? I have usually done the controls in the form/user control, who make calls to the data access layer to get data and load it into the form controls. There's still a bit of logic in the forms, but some co-workers are saying that virtually all logic, even calling data access objects, should be moved out to a business object layer. I'm curious as to what people think. It's something like this: Form1 OnLoad() { DataSet ds = DataAccess.CustomerTable.GetCustomerList(); dataGrid1.DataSource = ds; } And the CustomerTable object makes calls to the actual DB to get data. I'm not sure it's a win to move stuff like this out of the form, and there must be some event processing logic in it anyway. Discussion welcome. Eric |
|
|
|
#2 |
|
Guest
Posts: n/a
|
There are a lot of different opinions on this, but his is what i think.
If you need to apply business logic to data from your database go thru the business layer. When you just need data from the database that is just the way you want it, let the presentation layer directly access the data layer. I think this works the best and is easy to maintain. Why should you go thru the business layer when it doesn't add anything? HTH -- Jonne Kats Advisor ICT Solutions www.advisor.nl http://www.dotnetjunkies.com/weblog/jonne%20kats/ "Eric" <glorfindel02@hotmail.com> wrote in message news:LgPJa.75461$Pc5.36617@fed1read01... > > If you have a Windows Forms application, how do you divide up the logic > among the presentation, business and data access layer? > I have usually done the controls in the form/user control, who make calls to > the data access layer to get data and load it into the form controls. > There's still a bit of logic in the forms, but some co-workers are saying > that virtually all logic, even calling data access objects, should be moved > out to a business object layer. I'm curious as to what people think. > > It's something like this: > > Form1 > OnLoad() > { > DataSet ds = DataAccess.CustomerTable.GetCustomerList(); > dataGrid1.DataSource = ds; > } > And the CustomerTable object makes calls to the actual DB to get data. > > I'm not sure it's a win to move stuff like this out of the form, and there > must be some event processing logic in it anyway. > > Discussion welcome. > > Eric > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

