0
我有一個表與這些列加載POCO部分
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
問候!
其實經過大量的閱讀我認爲你是對的,最好的解決辦法是表分裂。這對我來說意味着不便,因爲我的Razor Views是在運行時用Reflection創建的。 順便說一下,我會離開繼承我的POCO :( – neo