关于特定于 ASP.NET MVC 和 JSON 的 DDD 概念的书籍建议?

发布于 2024-09-08 17:40:07 字数 1491 浏览 4 评论 0原文

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

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

发布评论

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

评论(2

呢古 2024-09-15 17:40:07

(我不提供书籍推荐。我只是发布答案,因为评论框中的空间不足)。

我不认为这种“模式”与 DDD 有太大关系,但这一切听起来都很吸引人,不是吗?

不过,我不得不说,这让人尖叫“我将在这个很棒的框架上工作很长时间,努力工作,最终几乎不会带来任何性能优势,但我会将它融入到我的应用程序中,因为我花了很多时间很长一段时间。”要么是这样,要么尝试实现这一点将阻止应用程序的实际实现。

ASP.NET MVC 模型绑定可以完成您的许多目标,尽管并不完全按照您描述的方式。它不做的是“只发回脏属性”位,但说实话,任何将从中受益的 Web 应用程序,毕竟客户端逻辑很可能在另一个层面上设计得很糟糕(数据未分页;个别视图太重)。

我没有看到在会话中缓存对象有任何好处,而且这对 ASP.NET MVC 系统来说是令人厌恶的。

使用一流的对象关系映射技术(例如 NHibernate)可以解决从存储库中仅加载所需的对象/集合的问题。

保存异步操作的 JSON。

除了所有这些之外,您所描述的内容可以松散地视为一组优化,一旦应用程序的核心开始工作,就可以以零碎的方式实现这些优化。这可以确保您提供一些价值,并且仅在性能不可接受的情况下才执行实施这些优化的实质性工作(如果它们甚至被证明是这样的话)。

(I am not providing a book recommendation. I'm only posting an answer because I ran out of space in the comment box).

I don't think this "pattern" has much to do with DDD, but it all sounds so appealing, doesn't it?

I have to say, though, that this screams "I'm going to work so long and hard on this awesome framework that will in the end net little to no performance benefit, but I'll wedge it into my application because I spent so long on it." Either that, or trying to implement this will prevent the application from actually being realized.

ASP.NET MVC model binding does a lot of what you're aiming for, albeit not in precisely the way you describe. What it doesn't do is the "only send back dirty properties" bit, but to be honest any web application that is going to net a benefit from this after all the client-side logic is more than likely poorly designed on another level (data not paged; individual views too heavy).

I don't see any benefit from caching the object in session and this is anathema to the ASP.NET MVC system anyway.

Loading only needed objects/collections from a repository is a solved problem using a first-class object-relational mapping technology, such as NHibernate.

Save the JSON for asynchronous operations.

All of this aside, what you are describing could be loosely considered as a set of optimizations that could be implemented in a piecemeal fashion, once the core of the application is working. This ensures that you deliver some value, and only do the substantial work of implementing these optimizations (if they even prove to be such) if performance is not acceptable.

夜司空 2024-09-15 17:40:07

Phil Haack 在他的博客中有很多内容,谈论 MVC 2 Futures、JSON 验证器、Json2.js 等。这一切都运作良好。 这个是帖子

Phil Haack has much of this in his blog, talking about MVC 2 Futures, JSON validators, Json2.js, and the like. It all works very well. This is the post.

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