DAL Design Question

I need to create a data access layer DAL.NET Enterprise library version 3.5 Data Access Application Block (DAAB) In my application I have various logical modules, such as Registration, Billing, Order Management, User Management, etc. I use C # business objects to map module objects to database tables, and then return the List collection to the client.

I would like to design my DAL in such a way that, if tomorrow we decide to use a different data access structure, we should have a minimal code change. Given this, how do I create a class structure? I thought that I would have a DbManagerBase class that would be a wrapper on top of an existing .net DAAB This DbManagerBase class would implement an IDbManagerBase interface that would have public methods like ExecuteReader, ExecuteNonQuery, etc.

Client class i.e. RegistrationDAL, UserManagermentDAL will have the following code inside each of its methods: IDbManagerBase obj = new DbManagerBase () obj.ExecuteReader (myStoredProcName),, is this a good OOPS design? Can I find out some better approach, please, or do I need to use inheritance here? Can I use all methods in the DbManagerBase and RegistrationDAL, UserManagermentDAL classes as static? I assume that if I have methods as static, then the above interface code will not make any sense ... right ???

+3
source share
2 answers

To really abstract the DAL, I would use a repository pattern .

+4

:

DbManagerBase RegistrationDAL, UserManagermentDAL ?

, , , DAL (, factory), DAL , . DbManagerBase , .

IDbManagerBase ExecuteReader, ExecuteNonQuery obj.ExecuteReader(myStoredProcName)

, . , .

, , DAL , - DAL , NHibernate Subsonic. , - .

DAL, github ( , )

+2

Source: https://habr.com/ru/post/1703837/


All Articles