使用相同的几个模块/应用程序(EF4) [英] Several modules/applications using the same entites (EF4)

查看:57
本文介绍了使用相同的几个模块/应用程序(EF4)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前有3个应用程序/模块使用相同的数据库,并且有一些架构问题。我们使用EF4和POCO实体生成器自动生成所有实体。据了解,我们有一个单独的项目,"DALProject",用于模型(.edmx)和上下文对象。此外,我们为生成的实体"EntityProject"提供了一个单独的项目,以使实体不与持久性技术相结合。

We currently have 3 applications/modules working with the same database and have some architectural questions. We use the EF4 and a POCO Entity Generator to automatically generate all the entities. As of know, we have a separate project, "DALProject", for the model (.edmx) and the context object. Furthermore, we have a separate project for the generated entities, "EntityProject", in order to have entities not coupled to the persistence technique.

这是问题所在..面向对象我们不希望我们的3个模块具有包含业务逻辑的静态处理程序。相反,我们考虑编写包含业务逻辑代码的实体的部分类。但是为了能够做到这一点,部分类需要属于与实体相同的项目,即EntityProject。这有两个方面很糟糕。首先,我们希望EntityProject具有普通的DTO。其次,这意味着我们的EntityProject将包含我们所有3个应用程序的业务逻辑。

Here's the problem.. To be object-oriented we do not want our 3 modules to have static handlers containing our business logic. Instead, we thought of writing partial classes of the entities containing the business logic code. But to be able to do this, the partial classes need to belong to the same project as the entities, i.e. the EntityProject. This is bad in two ways.. Firstly, we wanted an EntityProject to have plain DTOs. Secondly, this would mean that our EntityProject would contain the business logic for all our 3 applications.

我们理想的情况是每个应用程序的BLL-Project,EntityProject和DALProject。我们怎样才能实现这一目标,而BLL-Projects只包含我们实体的静态处理程序?

Our ideal situtation is BLL-Project for each application, an EntityProject and a DALProject. How can we achieve this and not have the BLL-Projects only containing static handler for our entities?

我希望我们的情况在某种程度上是可以理解的,并且有人有建议。这几乎不是一个独特的情况?

I hope that our situation is somehow understandable and that someone has suggestions. This could hardly be a unique situation?

谢谢:)

推荐答案

我正准备张贴同样的问题。 我们为拥有丰富会员资格,结算和内容架构的人提供了一个工具包。 他们添加了他们自己的东西,显然将使用这些其他实体。 我没有看到如何在EF中实现这一点,同时保持在多个实体类型的查询之间有效共享事务的能力(例如)。
I was just about to post the same question.  We have a toolkit we give to people that has a rich membership, billing and content schema.  They add on their own stuff that clearly will use these other entities.  I don't see how to accomplish this in EF while maintaining the ability to efficiently share transactions across queries of multiple entity types (for example).


这篇关于使用相同的几个模块/应用程序(EF4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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