Jos*_*ltz 3 entity-framework ef-code-first entity-framework-4.3
以前没见过这个错误,粗略的网页搜索很少见.这是(我认为)有问题的代码:
this.HasMany(a => a.ListItems).WithRequired()
.Map(m =>
{
m.MapKey("AttributeId");
m.ToTable("ProductAttributeListItem");
}
)
;
Run Code Online (Sandbox Code Playgroud)
这是完整的错误:
在模型中找不到指定的表'ProductAttributeListItem'.确保已正确指定表名.
桌子在那里拼写正确.
缺乏搜索结果让我觉得我错过了一些明显的东西.可能是什么?
如果要定义实体的表名,ListItems则引用您需要在实体上执行该操作,而不是在关系映射中:
modelBuilder.Entity<ListItem>() // or whatever the entity is called
.ToTable("ProductAttributeListItem");
Run Code Online (Sandbox Code Playgroud)
并m.ToTable从Map动作中删除.
| 归档时间: |
|
| 查看次数: |
2193 次 |
| 最近记录: |