如何构建数据访问层的 Visual Studio 项目

发布于 2024-09-02 19:31:07 字数 801 浏览 1 评论 0原文

我目前有一个项目,使用各种数据库访问技术,主要用于展示或演示。

目前我们有:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡笑忘祈一世凡恋 2024-09-09 19:31:07

我几乎会做相反的事情,并按 DAO 实现技术进行分组。

    - Namespace App.Data
       -NHibernate
         - SQLServer
         - Oracle
       -EntityFramework
         - SQLServer
         - Oracle

如果需要的话,您可以从那里分割 DLL。因此,您可以拥有 2 个 dll,也可以拥有 4 个您认为合适的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文