如果是 3 层域驱动设计的应用程序,模型应该驻留在哪里?
在典型的面向业务的瘦客户端应用程序(在我的例子中是 Silverlight)中,就域驱动设计而言,域模型应该驻留在服务器端或客户端或两者上。我应该在客户端使用我的域实体还是 DTO 进行操作吗?
如果我的应用程序支持“无服务器”模式,当它除了下载应用程序之外不与服务器通信时,该怎么办?目前,我的无服务器模式对应用程序是透明的,我仍然使用相同的服务接口,但提供它们的本地实现。
In a typical business oriented thin client application (in my case Silverlight) where should Domain Model reside on server side or client side or both in respect to Domain Driven Design. Should I operate with my Domain Entities or DTO's on client side?
What if my application supports "server-less" mode, when it doesn't communicate with server except for downloading application. Currently my server-less mode is transparent to application, I'm still using same service interfaces but provide local implementation of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,他们可以留在这两个地方。您可以拥有:
1)具有完整域的富客户端,并具有通过 ODATA 或其他方式访问后端的存储库。
2)瘦客户端通过命令和DTO访问服务器并且仅实现几个验证
3) 以及两者的混合。
不幸的是,没有一个单一的回应,一个项目不是另一个项目。这是一个背景问题。
如果您提供更多信息,我们可以尽力帮助您选择。
Well they can stay in both places. You could have:
1) Rich fat client with a full domain and having repository accessing the back end through ODATA or something.
2) Thin client making access to the server through command and DTO and only implementing couple of validation
3) and a mix of both.
There is no single response, unfortunately, one project is not the other. It is a question of context.
If you provided more information we could try to help you choose.
您应该在单独的程序集中创建模型,并从客户端和服务器引用它。
这样,您将能够轻松地从程序的两个部分访问模型,同时将其与图形和业务逻辑分开。
You should create your model in a separate Assembly, and reference it from both Client and Server.
This way you will be able to access the model from both parts of your program easily, while separating it from your graphic and business logic.