应用工作单元模式

发布于 2024-07-07 01:39:27 字数 105 浏览 6 评论 0原文

我在企业应用程序架构模式中读到,工作单元只能在单个会话中使用。 因此每个会话都应该有其唯一的工作单元。 谁能告诉我为什么我不能对整个应用程序使用一个工作单元(在我的例子中是 ASP.NET)。

I have read in Patterns of Enterprise Application Architecture that a Unit Of Work should only be used in a single Session. So each session should have its only Unit Of Work. Can anybody tell me why I could not use one Unit Of Work for the whole application (in my case ASP.NET).

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

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

发布评论

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

评论(1

做个ˇ局外人 2024-07-14 01:39:27

工作单元模式的一半是跟踪事务中的更改,您当然可以跟踪整个应用程序的更改(这似乎很常见),但另一半是并发问题的解决方案,如果您将模式应用于整个应用程序,而不是在每个会话级别。
另外,在某些时候,您必须决定“嘿,这是一个单位...提交时间”,并且当考虑到整个应用程序且不同用户同时执行不同的操作时,这可能会很困难。

Half of the unit of work pattern is to keep track of changes in a transaction and you could certainly track that for an entire application (this seems to be pretty common) but the other half is the resolution of concurrency problems which becomes meaningless if you are applying the pattern to the entire application rather than on a per session level.
Also, at some point you have to decide "Hey this is a unit...time to commit" and that might be difficult when taking the whole application into account with different users doing different things at the same time.

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