0
我在我的项目中有以下方法。实体框架地图模型到表
public IEnumerable<T> GetAll()
{
return _context.Set<T>().ToList();
}
然后我的DbContext有这个..
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
Entity<Product>.ToTable("Product");
}
这工作得很好,只要 “产品” 型号是同一个项目中。
但是,不同的客户端将使用我的DataAccess层,他们将传递不同类型的模型。我如何告诉EntityFramework动态地将模型绑定到SQL服务器中的“表”。
他们可以提供自己的[EntityTypeConfiguration]类(http://www.entityframeworktutorial.net/code-first/entitytypeconfiguration-class.aspx)。 –
我很难找到它的一个例子 – Khan