[英]How do you do map an entity to an table in Entity Framework 7?
I use to use the following configuration to map an entity
to a table with Entity Framework. 我曾经使用以下配置将entity
映射到带有Entity Framework的表。
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().ToTable("Users");
}
But in Entity Framework 7 the function ToTable
no longer exist. 但是在Entity Framework 7中,功能ToTable
不再存在。 Does anyone has a solution for this? 有人对此有解决方案吗?
Try using below method: 尝试使用以下方法:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<SomeClass>().ForRelational().Table(tableName: "Test", schemaName: "Map");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.