Data Access Layer in Windows App.

gpoch

Active member
Joined
Oct 28, 2006
Messages
34
Location
USA
Programming Experience
1-3
Hello all,

I've done ASP.NET apps using a multi-tier approach but never anything with Win apps. After some searching online I'm not finding much info to building DAL's for Win Apps.

I'm wondering what the concepts are to creating a Windows DAL (by the way I'm using SQL Express). This is a single user app with a local database. I'm also logging events to the database, usually about 500 events a day. Here are some of the questions I have?

Could I use the same concepts as I do in WebApps? (Fill my objects and close the connection)

Should I be doing more persistance in my DAL, like filling datatables?

Should I close connections after every read from the Database, or should I establish a connection as long as I can?

I know there are probably many approachs and no correct way but I would like to get some feedback on what works best for you.

Thanks again,
 
Your WinForms app and your WebForms app are presentation layers. You should be able to use the exact same data layer for both with absolutely no change whatsoever if it's been designed correctly. In fact, the presentation layers and the data layer shouldn't even be aware of each other's exeistence if you have a business layer in between. Both presentation layers should be able to reference the same business layer, and if you only have one business layer then there is no change whatsoever in the way you interact with your data layer. If there is no business layer then that still shouldn't make a difference. It's still just two presentation layers referencing the same data layer. The data layer should not be using any classes specific to either WinForms or WebForms. It should just receive data and requests for data and serve them accordingly.
 
Back
Top