3
之前沒有看到這個錯誤,粗略的網頁搜索變得很少。這裏是(我認爲)有問題的代碼:實體框架代碼優先:「在模型中找不到指定的表」foo「。」
this.HasMany(a => a.ListItems).WithRequired()
.Map(m =>
{
m.MapKey("AttributeId");
m.ToTable("ProductAttributeListItem");
}
)
;
下面是完整的錯誤:
The specified table 'ProductAttributeListItem' was not found in the model. Ensure that the table name has been correctly specified.
表是存在的,拼寫正確。
缺乏搜索結果讓我覺得我失去了一些明顯的東西。那可能是什麼?
這工作。奇怪的是,我以前使用SqlExpress並指定了'.ToTable(「foo」)。MapKey(「bar」)'進行映射,並且工作正常。轉移到Sql Enterprise改變了一些事情,它開始抱怨'表未找到'。 – TheVillageIdiot