问题描述
我有来自AdventureWorks2008数据库的以下关系表。
BusinessEntity(表)
BusinessEntityId Int(PK,Identity)
人(表)
BusinessEntityId int(PK,带有BusinessEntity表的参考)
FullName varchar(255)
此处Person表没有自动生成的Id,而是引用BusinessEntity表。
如果我使用Fluent NHibernate上面的映射将是
Id(x => x.BusinessEntityId)
.GeneratedBy.Foreign(" BusinessEntity");
如何在codefirst CTP 4中映射它?
AdventureWorks2008是一个复杂的关系设计,如果来自EF团队的人可以使用CodeFirst映射该数据库,那么这将是最好的例子。
谢谢
Ashraf。
I have the following relational table from the AdventureWorks2008 database.
BusinessEntity (Table)
BusinessEntityId Int (PK, Identity)
Person (Table)
BusinessEntityId int (PK, Reference with BusinessEntity table)
FullName varchar(255)
Here Person table do not have auto generated Id, instead it reference to BusinessEntity table.
If I use Fluent NHibernate the mapping for the above would be
Id(x => x.BusinessEntityId)
.GeneratedBy.Foreign("BusinessEntity");
How do I map it in codefirst CTP 4?
AdventureWorks2008 is a complex relational design, if someone from EF team can map that database using CodeFirst, then that would be the best example.
Thanks
Ashraf.
这篇关于CodeFirst一对一关系问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!