1
我想用自己的常量(而不是EF的字符串常量)替換鑑別器列。我班如下:鏈接繼承的EF鑑別器
[Table("stor_store")]
public abstract StoreBase { /* Base fields */ }
public StoreTemplate : StoreBase {/* Extra fields */ }
public Store : StoreBase {/* Extra fields */ }
[Table("cust_customer")]
public Customer : Store { /* Extra fields */ }
[Table("engi_engineer")]
public Engineer : Store {/* Extra fields */ }
我一直在試圖映射使用流利的API列:
modelBuilder.Entity<StoreBase>()
.Map<StoreTemplate>(m => m.Requires("stor_type").HasValue((byte)0)
.Map<Store>(m => m.Requires("stor_type").HasValue((byte)1))
.Map<Customer>(m => m.Requires("stor_type").HasValue((byte)2))
.Map<Engineer>(m => m.Requires("stor_type").HasValue((byte)3));
但是EF總是創建鑑別列。這個映射之前已經有效,但是雙嵌套繼承似乎已經拋出了它。謝謝你的幫助。
我並沒有解決我的問題,鑑別仍然存在重新排序後的地圖。但我想我會選擇TPT。 – Tim