EF4复杂类型的导航属性(有可能)或替代方案? [英] EF4 complex type with navigation property (is it possible) or alternatives?

查看:157
本文介绍了EF4复杂类型的导航属性(有可能)或替代方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打的墙做EF4模型DB第一种方法使用LINQ到实体POCO ...

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

我有两个表:客户名称preFIX 正在通过相关的名称prefixId 。栏目有:

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

Customer             NamePrefix
----------           ----------
CustomerId (PK)      NamePrefixId (PK)
NamePrefixId (FK)
LastName
FirstName
MiddleInitial
....

在这种情况下,客户实体具有导航属性名称preFIX 。 我创建了一个复杂类型 NameOfPerson ,这样我就可以在其他实体使用。 复杂类型由名称prefixId 名字名字 MiddleInitial 。 但现在我得到的导航性能以下错误消息名称preFIX

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.

这篇关于EF4复杂类型的导航属性(有可能)或替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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