【发布时间】:2011-08-09 15:15:26
【问题描述】:
我有一个包含这些列的表格
Id as integer
Name as string
Image as byte()
然后我做了两个POCO
Public Class TableBase
Id as Integer
Name as String
End Class
Public Class Table
Inherts TableBase
Image as byte()
End Class.
因为我并不总是需要加载图像。 问题是我收到了一个判别错误,而 TPH 东西的解决方案没有解决它。因为我无法在数据库表中添加鉴别列。
...
modelBuilder.Entity<Table>()
.Map(mc => mc.Requires("TableType").HasValue("Base"))
...
其实我没有层次问题;我只需要部分加载 POCO
问候!
【问题讨论】:
标签: .net entity-framework ef-code-first code-first