Business Entity, Data Access Object,Business Component

In this article i will present my implementation for Business Entity and Data Access Object.

Generally the access to database object, should be separated in 2 or more layers. In my case i’ve created only 2 layers – DAO and BC.

Business Entity – according to MSDN article, the object should be an representation of data. In my case i’ve created an CommonDatabase class who implements ICloneable and IDisposable interfaces. This object is always Serializable.

The Business Entity Object is defined as an inherit object from CommonDatabase:

The Data Access Object – is generally an class who can access the database and execute the Insert,Update,Delete,Select functions.

As following I present my implementation of DAO:

All this example of DAO, uses stored procedures to select,insert, update, delete data from database.

Following i present only the most important SP’s – insert, select. 🙂

Select SP :

Inset SP:

This sample of code are taken from the following project. As usual you can modify them as you wish. 🙂

Later Edit (04/03/2015):  I’ve modified the article so that it will use only .Net Framework classes. Removed Microsoft Enterprise Library Reference.:)

Posted in C#.