The blog of Eric Sibly; focusing on mountain biking, .NET development for the Desktop, Smartphone and PocketPC.

Wednesday, March 29, 2006

Custom Entity Classes...

I have been a proponent of Custom Entity Classes over DataSets for some time; and fully acknowledge that the latter has value in certain situations, specifically prototyping or basic two tiered applications. Where as the former, offers greater flexibility for some extra effort that really pays dividends within an Enterprise solution.

The project that I am currently architecting/managing has implemented this style of Entity; this was a foundational decision and certainly a departure from the way the customer currently chooses DataSets. These have worked out extremely well within our solution and I hope they (Customer) will look at this as an alternative in the future for other future applications.

The real benefit I see is that by utilising OO concepts we can realise the benefits of encapsulation and inheritance with our Entities, and we have a clean decoupling from the database (there is in fact no reference to the DB within these whatsoever – data management classes were created for this that lived in an appropriate logical data layer tied directly to the DAL). For a number of our Entities, code generation was used which sped up the creation and also improved the consistency of the code. Typed collections were created that made the experience of using these Entities very natural. Then of course, other Entity specific methods can and were added to these Entities/Collections that offer there own value-add function.

So when I discovered this old article last night I was very pleased to see this very approach promoted. This is an excellent article that articulates the benefits in an easy to read manner, with clear examples, and is an added resource I can now use to help convince future Customers of the benefits of Entities.


Post a Comment

<< Home