【发布时间】:2015-03-06 16:41:49
【问题描述】:
我正在尝试在 EF Code First 中使用 Conventions over Configuration 来定义 0..1 - 1 关联...但是我遇到了错误:
无法确定之间关联的主体端 类型 'Bar' 和 'Foo'。该关联的主体端必须是 使用关系流式 API 或数据显式配置 注释。
我的 POCO 课程如下:
Public Class Foo
Public Property ID As Integer
Public Property Description As String
Public Overridable Property Bar As Bar
End Class
Public Class Bar
Public Property ID As Integer
Public Property FooID As Integer
Public Property Description As String
Public Overridable Property Foo As Foo
End Class
有人知道我哪里出错了吗?
以下是我正在使用的一些资源:
https://msdn.microsoft.com/en-us/data/jj713564
http://www.entityframeworktutorial.net/entity-relationships.aspx
How to tell EntityFramework 5.0 that there's a one-to-one association between two entities?
【问题讨论】:
标签: .net vb.net entity-framework