I would recommend an object oriented solution for this. Presumably your database is for tables representing logical groupings of data. Each of these tables can be mapped to a class on your system, although in some cases there may be more than one table that makes up the object, or there may be several classes that the table compares using a subclass. If you need to display data from several tables β say, a list of orders with some data from a customer related to an order β then you can use views, joins, or stored procedures to create a view class object that represents the selected data in the / join / sp view .
Essentially, I am describing an N-tier data architecture where you have a low-level access level that processes data from an SQL orientation β tables, views, stored procedures. Above this, there may be a common layer of an object that deals with common data objects and interfaces with a data access level for storing / retrieving objects from the database. Finally, on this you have a strongly typed level of a business object, where your application works with classes that are semantically related to your application - orders, customers, invoices, etc. There are many different templates for implementing this type of common architecture, and you should research a few to see what suits your application, the very best. You might want to use object-relational mapping directly, such as LINQ or nHibernate, or you might want to put the repository on top of ORM.
Personally, I believe that structuring your application to work with objects in the context of your domain, and not just as table data, will improve your code. This should improve comprehensibility and maintainability. You will be able to encapsulate behavior in your domains, rather than distributing it throughout the application. Of course, this assumes that you are following good design techniques, but using OO design will help. Separating your business logic and data with your mapping logic will also make your application more robust, as it breaks up monolithic classes into smaller, more focused classes that are interconnected.
source share