Multi-layer architecture generally involves presentation layer, business logic layer, data access layer etc. which are spitted according to specific responsibility, target as well as boundary. A well designed multi-layered application simplifies the modification, update of code.
One primary design consideration while developing software is the “Business Entity” which is the data container and is passed among the layers with data. .NET framework has a rich functional built-in data container, which is DataSet, which can contain multiple tables, relations, need not to be opened the database connection all the time and thus application data operations can be done in disconnected.
A dataset can be typed or untyped/generic database. Type dataset has good sort of “Readability” as it’s properties maps the required fields while writing codes. Now the issue is while we consider a specific entity to be mapped to typed dataset, it is fine while writing codes, since we don’t have to remember the data table fields, as well as it makes later modification much easier. However, what if, when we need a business entity that contains fields from multiple entities (i.e. joined tables)? Well when we consider our business entity is “dataset”, we don’t have any problem in this case, as we have “Generic dataset”, which renders fields dynamically.
Dataset is really good business entity or data container. But it has performance overhead, and a complex set object model. Sometimes we these issues become important and we need to find a simpler and better mode.
Rather using the built-in object model of dataset as data container, we can create our own classes, by getting data from data base and put those into the corresponding data container. However, the main problem with this choice is, custom business entity requires time to develop.
Well I was really confused when I had a situation where I had to use custom business entity, but what should I do when I need to generate a query from multiple database tables. Of course any specific custom business entity will not fit in this context, specially when there are lots of queries with several combination of database tables.
In some data tier generator, I have seen that, beside generating custom business entity, they also used untyped dataset specially in queries. Well this might be a solution, I didn’t like this concept, since I want to make the design to have a uniform object model for business entity. I am still thinking about this, and hoping in future I will be able to get a proper answer about this.
| posted on Saturday, July 8, 2006 2:53 PM