Come posso ottenere uno List
di tutti i DbSet in cui il tipo contenuto deriva da IncomingServiceOrderBase
?Come posso trovare tutti i DbSet i cui tipi generici derivano da un determinato tipo di base?
È possibile utilizzare la riflessione per ottenere tutti i DbSet, ma come faccio a ridurli solo a quelli che contengono un tipo derivato?
Contesto
public class MyContext : DbContext
{
public DbSet<BuildingOrder> BuildingOrders { get; set; }
public DbSet<DeliveryOrder> DeliveryOrders { get; set; }
public DbSet<RetailAssemblyOrder> RetailAssemblyOrders { get; set; }
}
Modello
public class BuildingOrder : IncomingManufacturedProductOrderBase { }
public class DeliveryOrder : IncomingServiceOrderBase { }
public class RetailAssemblyOrder : IncomingServiceOrderBase { }