How to structure a Visual Studio project for the data access layer
I currently have a project that uses various DB access technologies mainly for showcasing or for demos.
Currently we have:
Namespace App.Data (App.Data.dll)
Folder NHibernate
Folder EntityFramework
Folder LinqToSql
The above structure is ok as we only use Sql Server as the DB. But going forward we will be including Oracle, MySql etc.
So what would be a better structure with this in mind?
I thought about:
Namespace App.Data.SqlServer (App.Data.SqlServer.dll)
Folder NHibernate
Folder EntityFramework
Folder LinqToSql
Or would it just be better to have separate assemblies for each database and access 开发者_运维百科technology?:
Namespace App.Data.SqlServer.NHibernate (App.Data.SqlServer.NHibernate.dll)
Namespace App.Data.SqlServer.EntityFramework(App.Data.SqlServer.EntityFramework.dll)
Namespace App.Data.Oracle.NHibernate (App.Data.Oracle.NHibernate.dll)
Namespace App.Data.MySql.NHibernate (App.Data.MySql.Oracle.dll)
I would almost do the opposite, and group by DAO implementation technologies.
- Namespace App.Data
-NHibernate
- SQLServer
- Oracle
-EntityFramework
- SQLServer
- Oracle
And from there you could split DLLs if it is nessessary. So you could either have 2 dlls, or 4 however you see fit.
精彩评论