Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/DotNetEd.CoreAdmin/CoreAdminConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ private static void FindDbContexts(IServiceCollection services, CoreAdminOptions
var discoveredServices = new List<DiscoveredDbSetEntityType>();
foreach (var service in services.ToList())
{
if (service.ImplementationType == null)
if (service.ServiceType == null)
continue;
if (service.ImplementationType.IsSubclassOf(typeof(DbContext)) &&
!discoveredServices.Any(x => x.DbContextType == service.ImplementationType))
if (service.ServiceType.IsSubclassOf(typeof(DbContext)) &&
!discoveredServices.Any(x => x.DbContextType == service.ServiceType))
{
foreach (var dbSetProperty in service.ImplementationType.GetProperties())
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.ImplementationType,
DbContextType = service.ServiceType,
DbSetType = dbSetProperty.PropertyType,
UnderlyingType = dbSetProperty.PropertyType.GenericTypeArguments.First(), Name = dbSetProperty.Name });
}
Expand Down