哪种设计模式适合您? ASP.NET 与 MySQL

发布于 2024-09-10 16:43:38 字数 347 浏览 1 评论 0原文

大家好,这是一个向所有使用 ASP.NET(C#) 和 MySQL 创建 Web 应用程序的经验丰富的开发人员提出的问题。我目前正在使用 Microsoft Enterprise Library 来实现数据库工厂设计模式。

我有一个返回数据表的 DAL。我有一个执行 DAL 的 BLL,它返回一个 List<>我的数据对象。 BLL 具有用于排序、限制记录和过滤器的参数。

您认为到目前为止,适合事务查询和包含大量联接(4 到 10 个表)和条件的查询的良好设计模式是什么。

我对当前的实施并不满意,我不知道从长远来看它是否对我有用。我继续创建 DataObjects -> BLL->每次都有DAL课程。

Hi this is a question to all experienced developers who create their web applications using ASP.NET(C#) with MySQL. I am currently using the Microsoft Enterprise Library to implement a database factory design pattern.

I have a DAL which returns a DataTable. I have a BLL that executes that DAL which returns a List<> of my DataObjects. The BLL has parameters for sorting, limit records, and filters.

What do you think is by far a good design pattern that will work for transactional queries and queries containing a number of joins (4 to 10 tables) and conditions.

I am not satisfied with the current implementation and I don't know if it'll work for me in the long run. I keep on creating DataObjects -> BLL -> DAL classes every time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

内心激荡 2024-09-17 16:43:38

对于事务查询,我会查看进入 UnitOfWork 模式,它可以帮助管理更新在一个过程中修改的多个对象的复杂性,这些对象可以被视为单个工作单元(通常直接与单笔交易)。

对于具有多个联接的查询,查看 进入 命令查询职责分离。 CQRS 背后的总体思想是,当我们查询数据(例如,用于报告)时,我们的数据访问模式与我们请求数据进行修改时的数据访问模式看起来非常不同。 CQRS 告诉我们接受这种差异,并以不同的方式编码我们的访问,因为每种类型的访问的技术要求确实如此不同。

For transactional queries, I'd look into the UnitOfWork pattern, which can help manage the complexities of updating several objects that are modified during a process that can be considered a single unit of work (often associated directly with a single transaction).

For queries with many joins, look into Command-Query Responsibility Segregation. The general idea behind CQRS is that our data-access patterns look very different when we are querying data (e.g., for reporting) than when we are requesting data to modify it. CQRS tells us to embrace this difference and code our access differently because the technical requirements of each type of access are truly so different.

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