如何构建数据访问层的 Visual Studio 项目
我目前有一个项目,使用各种数据库访问技术,主要用于展示或演示。
目前我们有:
Namespace App.Data (App.Data.dll)
Folder NHibernate
Folder EntityFramework
Folder LinqToSql
上面的结构是可以的,因为我们只使用 Sql Server 作为数据库。但展望未来,我们将包括 Oracle、MySql 等。
那么考虑到这一点,什么是更好的结构呢?
我想:
Namespace App.Data.SqlServer (App.Data.SqlServer.dll)
Folder NHibernate
Folder EntityFramework
Folder LinqToSql
或者为每个数据库和访问技术提供单独的程序集会更好吗?:
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 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我几乎会做相反的事情,并按 DAO 实现技术进行分组。
如果需要的话,您可以从那里分割 DLL。因此,您可以拥有 2 个 dll,也可以拥有 4 个您认为合适的 dll。
I would almost do the opposite, and group by DAO implementation technologies.
And from there you could split DLLs if it is nessessary. So you could either have 2 dlls, or 4 however you see fit.