以OrganizationUnit爲例,進行擴展,加入IsUse屬性
1.建立一個新類,好比ExtendedOrganizationUnit,繼承OrganizationUnitc#
public class ExtendedOrganizationUnit: OrganizationUnit { public bool IsUse { get; set; } }
2.把ExtendedOrganizationUnit添加到DbContext裏code
public virtual DbSet<ExtendedOrganizationUnit> ExtendedOrganizationUnits { get; set; }
3.使用ef code first遷移命令繼承
add-migration add_ExtendedOrganizationUnit_table update-database
成功get