Skip to content

Commit

Permalink
Merge pull request #79 from AbdoMahfoz/bug-targetChildList
Browse files Browse the repository at this point in the history
Fixed a bug where having any non generic property in DbContext would cause the code to crash
  • Loading branch information
edandersen authored Nov 21, 2023
2 parents 02e46da + b483515 commit 3dc5d04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,4 @@ MigrationBackup/
/src/DotNetEd.CoreAdmin/out/*
/src/DotNetEd.CoreAdmin/out/*
/src/DotNetEd.CoreAdmin/out/*
.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ private object GetDbSetValueOrNull(string dbSetName, out DbContext dbContextObje
var propsOnDbContext = dbContextObject.GetType().GetProperties();

var targetChildListOnDbContext = dbContextObject.GetType().GetProperties()
.FirstOrDefault(p => p.PropertyType.GetGenericTypeDefinition() == typeof(DbSet<>)
.FirstOrDefault(p => p.PropertyType.IsGenericType
&& p.PropertyType.GetGenericTypeDefinition() == typeof(DbSet<>)
&& p.PropertyType.GetGenericArguments().First().FullName == typeOfChild.PrincipalEntityType.Name);

var primaryKey2 = dbContextObject.Model.FindEntityType(typeOfChild.PrincipalEntityType.Name).FindPrimaryKey();
Expand Down

0 comments on commit 3dc5d04

Please sign in to comment.