We have seen at many places we are preferred to use Custom entity classes over Dataset, I came across some useful articles which has reason behind this, and sample code for Base entity and entity collection classes (including non-generic as well as generic(.Net 2.0) version).
On the Way to Mastering ASP.NET: Introducing Custom Entity Classes
http://msdn2.microsoft.com/En-US/library/aa479317.aspx
In brief
Problem with DataSet
- Lack of Abstraction
o The first and most obvious reason to consider alternatives is the DataSet’s inability to decouple your code from the database structure.
- Weakly-Typed
o DataSets are weakly-typed, which makes them error prone and likely to impact your development effort.
- Not Object-Oriented
o DataSets are objects and C# and Visual Basic .NET are object-oriented (OO) languages doesn’t automatically make your usage of them object-oriented. The “hello world” of OO programming is typically a Person class that is sub-classed by an Employee class. DataSets, however, don’t make this type of inheritance, or most other OO techniques, possible (or at least natural/intuitive).
Benefit with Custom Entity Classes
- Take advantage of OO techniques such as inheritance and encapsulation
- You can add custom behavior
- Object-Relational Mapping
- Mapping Custom Collections
- Managing Relationships between two entities in Object oriented way