实体框架n层解决方案
我正在创建一个新项目,该项目紧密遵循本示例所使用的设计。
我有 WPF 或 ASP.NET 应用程序它与 WCF 服务通信,然后将其发送到业务层来完成大部分工作。
生成 POCO 对象,然后将该模板移动到模型项目,这将允许我访问业务层和数据层中的这些对象。我的问题是数据访问层在这种情况下提供什么目的?它似乎只保存 .edmx 文件。
这是标准做法,还是我只需将 .edmx 文件放入业务层即可获得更高的效率?
I'm creating a new project that is following closely to the design used by this example.
I have a WPF or ASP.NET app that talks to a WCF service which then sends it to the business layer to do most of the work.
The POCO objects are generated and then that template is moved to a Model project which will allow me to access those objects in the business and data layers. My question is what purpose does the Data Access Layer provide in this situation? It seems to be only holding the .edmx files.
Is this standard practice, or would I get better efficiency by simply putting the .edmx files into the Business Layer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DAL通常提供模型和数据库表之间的映射。根据您的描述,您将映射部分移至模型中。但我不确定这是一个好的做法。例如,作为数据库表,您还需要更改/构建模型项目。如果您稍后决定使用 NHibernate 而不是 EF 怎么办?由于这些原因,我认为映射应该在 DAL 中,并且 DAL 可以是一个单独的项目。
DAL generally provides with mapping between models and database tables. According to your description, you moved the mapping part into models. I am not sure that's a good practice though. As database table, for example, changes you need to change/build model project as well. What if you decide later to use NHibernate instead of EF? For these reasons, I think the mapping should be in DAL and DAL can be a separate project.