每种混凝土类型和关联的表格 [英] Table per Concrete Type and Associations

查看:55
本文介绍了每种混凝土类型和关联的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在这里有一个场景,我试图用EF来解决,但是我遇到了一些问题。

这是一个简化的情况:我有三张桌子( A,B和C)。 B和C都是基类(Base)的具体实例。他们也都与A有关系。现在,我宁愿拥有一个Base的集合而不是AB和AC。我如何将数据模型中的多个关联映射到一个关联概念模型?这甚至可能吗?

Hi everyone,

I have a scenario here that I am trying to figure out with EF, but am having some problems.

Here is a simplified situation:  I have three tables (A, B, and C).  Both B and C are concrete instances of a base class (Base).  They also both have a relationship to A.  Now, instead of having A.B and A.C, I would rather have a collection of Base instead.

How do I map the multiple associations in the data model to a single association in the conceptual model?  Is this even possible?

推荐答案

在V1中使用EF时,无法共享关联在TPC场景中的类型之间。

这是由于实体框架中的映射限制,当从A导航到B或C时,实体框架不知道要与哪个表进行通信,因此必须有一个我们目前不支持的联合样式查询。

当然我们假设我们真的在谈论TPC而不是TPT,这是完全支持的。

iTPC:意味着(对我来说,每种类型都有一个表,并且该类型的每个属性,引入或继承都在该类型的表中。这与TPT的不同之处在于,每种类型都有一个表,但只有引入的属性(和键)在特定类型的表中。

我的答案是基于你的意思TPC。

请确认
干杯



With the EF in V1 it is not possible to share associations between types in a TPC scenario.
 
This is due to a mapping limitation in the Entity Framework which when navigating from A to either B or C the Entity Framework doesn't know which table to talk to, and hence would have to have a union style query which we currently don't support.

This assumes of course we really are talking about TPC and not TPT, which is fully supported.

iTPC: means (to me) that there is a table for every type, and every property of that type, introduced or inherited is in the table for that type. This is different from TPT in that again there is a table for every type, but only the introduced properties (and the key) are in the table for a particular type.

My answer is based on the assumption you mean TPC.

Please confirm
Cheers
Alex


这篇关于每种混凝土类型和关联的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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