Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am currently designing an application (.Net WinForms) that needs to access a database (SQL Server).

Using the datasource wizard, Visual Studio automatically creates the dataset, tables and classes for rows:

For example if I have the Customers table the wizard will create “CustomersRow” class that inherits from Global.System.Data.DataRow with the corresponding fields as properties.

In my application I need to implement other methods and attributes for the Customers class.

How to deal with these generated classes, modify them by adding methods.. or ignoring them and implement my own business classes?

A second question:

How to populate my objects (eg list of customers?)

Do you suggest using datatables / dataset and their methods or build my own data access layer and I meet the client list (of customers)?

I found some patterns when searching the net but it is not precise.

Thanks
Posted

There is a complete walkthrough of developing N-Tier Apps over at MSDN; http://msdn.microsoft.com/en-us/library/bb384398.aspx[^]

There are also some excellent videos in both the C# and VB developer areas in the 'How Do I', forms over data sections and some of the other sections.
 
Share this answer
 
Comments
Simon Bang Terkildsen 24-Sep-11 11:54am    
+5 good link
I would recommend creating your own "entity" objects and "data access layer" to populate them [Domain Model].

Microsoft certainly offers very good support for Datasets etc. but it seems to be moving away from Table Model style of programming, for example there is no Datasets in Silverlight.

This entails more work for you, but does give you more room to maneuver and change technologies when the need arises.

I would not recommend putting the data access code inside your entities (some prefer this as it is all in one place), but prefer externalizing the filling of entities from outside and keeping entities for pure data transfer.
 
Share this answer
 
Comments
Simon Bang Terkildsen 24-Sep-11 11:54am    
Damn I hate DataSet.
I agree there should not be any data access code in the entities, they should only contain data. +5
Mehdi Gholam 24-Sep-11 12:03pm    
Datasets are huge ugly beasts, but it does simplify data transfer and databinding mostly because of the built in tool support. And there is still nothing like the dynamic nature of it (I'm working and POCO alternative, but not there yet).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900