EntityFramework 如何建几个结构一样的表
EntityFramework 怎么建几个结构一样的表
这样出错.
------解决方案--------------------
有没有试过继承类
------解决方案--------------------
为什么要建结构一样的表?说说你的应用场合。
public class Category
{
public string CategoryId { get; set; }
public string Name { get; set; }
}
public class ProductContext2 : DbContext
{
public DbSet<Category> Categories1 { get; set; }
public DbSet<Category> Categories2 { get; set; }
}
这样出错.
------解决方案--------------------
有没有试过继承类
public class Category1: Category
{
}
public class ProductContext2 : DbContext
{
public DbSet<Category1> Categories1 { get; set; }
public DbSet<Category2> Categories2 { get; set; }
}
------解决方案--------------------
为什么要建结构一样的表?说说你的应用场合。