English 中文(简体)
EF 4.1 表-表-等级
原标题:EF 4.1 Table-per-Hierarchy

Im试图从http://msdn.microsoft.com/en-us/library/d793152.aspx上推广。 我有两个表格:

PERSON

[PersonID] [int] IDENTITY(1,1) NOT NULL,
[PersonTypeID] [int] NOT NULL,
[Name] [varchar](50) NOT NULL,
[HourlyRate] [int] NULL

PersonType

[PersonTypeID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NOT NULL

在欧安论坛设计师中,我担任辅导员,创建名为“雇员”的新实体,并指定个人为基类。 然后将小时工资财产移至雇员。 在图谱窗口中,我向个人表绘制了该实体的地图,并适当绘制了日平时地财产图,以达到正确的行程。 然后,我将人定为抽象的人。

If I build it now without specifying a condition and a discriminator in the Employee entity, it builds fine. If I follow the tutorial and specify HourlyRate as the condition and use "Is" "Not Null" as the discriminator, it builds fine.

但是,我想利用个人计算机信息数据库作为消毒者,雇员应当拥有1个人计算机信息。 因此,我选择个人计算机信息数据库作为条件领域,“=”作为操作者,1为价值。 当我建造时,VS告诉我,它取得了成功,但在Error窗也有一些东西。

Error 3032: Problem in mapping fragments starting at line 798:Condition member Person.PersonTypeID with a condition other than IsNull=False is mapped. Either remove the condition on Person.PersonTypeID or remove it from the mapping.

我在另一篇文章中读到,我需要删除个人实体的人身航行财产。 因此,我尝试了这一错误,但依然有同样的错误。

I thought I was able to get this to work before on another project but I m not sure what changed for this one. The only thing different that I can think of is that I recently updated to EF 4.1.

This is what I have set up in the designer

“entergraph

任何建议都受到高度赞赏!

最佳回答

我是这样说的。 将个人计算机实体添加到设计师身上,将一切照旧。 关键是删除人身航行财产以及个人财产。 但是,由于我包括个人计算机实体,删除个人计算机数据库打破了外国的主要制约因素。

我不把人贩子实体包括在内,就可以删除人贩子,一切顺利汇编。

问题回答

暂无回答




相关问题
Getting exact error type in from DbValidationException

I have the situation where I m initializing my model in DatabaseInitializer() for EF 4.1 and get this annoying error "Validation failed for one or more entities. See EntityValidationErrors property ...

Entity framework 4 - custom complex type mapping

I have a poorly written legacy database schema that I m working with via EF Code First. I m currently mapping POCO entities and would like to create an "Address" complex type and use this everywhere ...

热门标签