-
Notifications
You must be signed in to change notification settings - Fork 122
Description
Hi
this works for me:
if (!service.ServiceType.IsSubclassOf(typeof(DbContext))) continue; if (discoveredServices.Any(x => x.DbContextType == service.ServiceType)) continue; foreach (var dbSetProperty in service.ServiceType.GetProperties()) { // looking for DbSet<Entity> if (dbSetProperty.PropertyType.IsGenericType && dbSetProperty.PropertyType.Name.StartsWith("DbSet")) { if (!options.IgnoreEntityTypes.Contains(dbSetProperty.PropertyType.GenericTypeArguments.First())) { discoveredServices.Add(new DiscoveredDbSetEntityType() { DbContextType = service.ServiceType, DbSetType = dbSetProperty.PropertyType, UnderlyingType = dbSetProperty.PropertyType.GenericTypeArguments.First(), Name = dbSetProperty.Name }); } } }
I'm not using Code First but DB First and Aspire. ImplementationType is null as Factory is being used. Don't know if that has implications elsewhere.