如何获取List
包含类型派生自的所有 DbSet IncomingServiceOrderBase
?
我可以使用反射来获取所有 DbSet,但是如何将其过滤到仅包含派生类型的那些?
语境
public class MyContext : DbContext
{
public DbSet<BuildingOrder> BuildingOrders { get; set; }
public DbSet<DeliveryOrder> DeliveryOrders { get; set; }
public DbSet<RetailAssemblyOrder> RetailAssemblyOrders { get; set; }
}
模型
public class BuildingOrder : IncomingManufacturedProductOrderBase { }
public class DeliveryOrder : IncomingServiceOrderBase { }
public class RetailAssemblyOrder : IncomingServiceOrderBase { }