开发者

EF4 complex type with navigation property (is it possible) or alternatives?

开发者 https://www.devze.com 2023-02-16 06:47 出处:网络
I hit the wall with doing EF4 Model with DB first approach using Linq-to-Entities with POCO... I have two tables: Customer and NamePrefix that are related via NamePrefixId. Columns are:

I hit the wall with doing EF4 Model with DB first approach using Linq-to-Entities with POCO...

I have two tables: Customer and NamePrefix that are related via NamePrefixId. Columns are:

Customer             NamePrefix
----------           ----------
CustomerId (PK)      NamePrefixId (PK)
NamePrefixId (FK)
L开发者_JAVA百科astName
FirstName
MiddleInitial
....

In this instance the Customer entity has a navigational property NamePrefix. I created a complex type NameOfPerson, so that I can use it in other entities. The complex type consists of NamePrefixId, LastName, FirstName, MiddleInitial. But now I am getting the following error message on the navigational property to NamePrefix:

Error 111: There is no property with name 'NamePrefixId' defined in type referred by Role 'Customer'.

Is there a way to accomplish this?


This is described directly in Complex type help page. Complex types cannot contain navigation properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号