处理模块化应用程序的数据

发布于 2024-12-04 07:16:43 字数 120 浏览 0 评论 0原文

我创建了一个模块化应用程序,其中每个模块仅通过具有强大接口的另一个模块进行通信。最近我发现我们未能完全分离模块,因为每个模块下面都有一组共享的对象。

分离这一层的最佳方法是什么?数据对象表示屏幕上显示的新记录。

I created a modular application where each module only communicates through the other one with strong interfaces. Recently I found that we failed to separate the modules completely because there is a shared set of objects underneath that each of the modules access.

What is the best way to separate this layer out? The data objects represents that that is displayed on the screen for a new record.

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

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

发布评论

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

评论(2

£烟消云散 2024-12-11 07:16:43

看来我和你在同一条船上。如果您有 ORM(例如 EF)和某种业务对象框架(RIA 服务、DevForce),那么您几乎“锁定”为在每一端(客户端/服务器)都有 1 个程序集

如果您想继续并打破这一点我认为这会导致更多的问题,而不是值得的。您将在连接来自不同模块的实体时遇到问题,您将在不同的数据模块中遇到重复的实体,等等。如果您已经分解了 ORM 层,那么请务必在客户端上保持其相同。

我将只创建一个数据项目(它甚至不是 Prism 中的模块)并从所有模块引用它。就我而言,我从主项目引用它并设置“CopyLocal=true”,以便 MEF 了解这些实体,我从其他模块引用它并设置“CopyLocal=false”。

Looks like I'm in a same boat as you. If you have ORM(EF for example) and some kind of business object framework (RIA Services, DevForce) than you pretty much "locked" into having 1 assembly on each end (client/server)

If you want to go ahead and break this down I think it will cause more problems then it's worth. You will have issues joining entities from different modules, you will have repeating entities in different data modules, etc. If you already have ORM layer broken down - then by all means keep it same on client.

I would create just one data project (it's not even module in Prism) and reference it from all modules. In my case I reference it from main project and set "CopyLocal=true" just so MEF knows about those entities and I reference it from other modules and set "CopyLocal=false".

柠栀 2024-12-11 07:16:43

您通常会为您的应用程序创建一个包含所有共享类的域程序集(myproject.Infra设施)。所有项目都会引用此程序集。通过这种方法,您的模块不会直接相互引用。 (另请参阅 Prism stocktrader 参考实现)

You typically create a domain assembly for your application (myproject. Infrastructure) that contains all shared classes. This assembly is referenced by all projects. With this approach your modules dont reference each other directly. (see also prism stocktrader reference implementation)

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