数据模型在Prism应用中的位置? [英] Where does the data model go in a Prism app?

查看:109
本文介绍了数据模型在Prism应用中的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将数据模型放入Prism应用程序的位置时遇到麻烦.大多数(如果不是全部)或我们的数据将来自Web服务,并且Web服务对于每个模块都是唯一的.不幸的是,会有一些需要共享的对象(例如人/用户对象).

I'm having trouble where to put our data model in our Prism app. Most, if not all or our data will be coming from web services and the web services are unique for each module. Unfortunately, there will be objects that need to be shared (such as a person/user object).

我真的为是否将这些服务直接添加到模块而感到痛苦,以至于每个服务都是真正独立的,还是创建一个单独的项目来容纳Web服务代理和业务实体.

I'm really torn about whether to add these services directly to the module, so that each is truly independent, or create a separate project to house the web service proxies and business entities.

这些模块是由不同的团队构建的,但是都将存在于相同的解决方案中(当然还有源代码控制).

The modules are being built by different teams, but will all live in the same solution (and source control, of course).

推荐答案

您会发现问题的答案是主观的,每个人的回答可能有所不同.

You will find the answer to you question to be subjective and each person may answer this a bit differently.

我个人试图保持足够的间隔,因为我不知道将来我的要求在哪里改变.例如,我可能正在构建一个ASP.NET应用程序,然后要求做同一件事的WinForm版本.

Personally I try to keep enough separation as I don't know where my requirements my change in the future. For example I might be be building a ASP.NET app and then asked to do a WinForm Version of the same thing.

将模型添加到独立的程序集中,无论项目类型如何,都可以重用该程序集.因此,如果我在构建Silverlight应用程序或Winform应用程序的地方,则可以使用相同的模型.

Adding your model to an independent assembly allows you to reuse that assembly regardless of project type. So if I where building a Silverlight app or a Winform app I can use the same model.

但是,我相信您的问题的核心是您是否应该将每个Web服务的数据模型分为不同的程序集.我认为将每个人分离到自己的项目中有点过大.

But, I believe the heart of your question is if you should separate you data model for each web service into a different assembly. I think it's a bit of overkill to separate each out into it's own project.

我将确保该模型不依赖于Web服务代码,就好像您将来更改需求时,您可能会发现自己通过另一种方法获取数据一样.

I would make sure that the model is not dependent on the web services code, as if you change requirements in the future you may find yourself getting the data through another method.

对我来说,分离的关键领域是:

The key area of separation for me are:

  • 数据访问层
  • 业务对象层(模型)
  • 用户界面层

这篇关于数据模型在Prism应用中的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆