Skip to content

Commit 59cfa80

Browse files
author
jaguzman
committed
Fixed exception for the nhibernate context for un-mapped properties
1 parent b487e42 commit 59cfa80

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/DotNetToolkit.Repository.NHibernate/Internal/NHibernateConventionsHelper.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ public string GetColumnName(PropertyInfo pi)
4141
}
4242

4343
public bool IsColumnMapped(PropertyInfo pi)
44-
=> GetPropertyNames(pi).Contains(pi.Name);
44+
=> GetPropertyNames(pi)
45+
.Contains(pi.Name);
4546

4647
private string[] GetPropertyNames(PropertyInfo pi)
4748
{
4849
var persister = GetAbstractEntityPersister(Guard.NotNull(pi, nameof(pi)).DeclaringType);
4950

50-
return persister.KeyColumnNames.Concat(persister.PropertyNames).ToArray();
51+
if (persister == null)
52+
return new string[] { };
53+
54+
return persister
55+
.KeyColumnNames
56+
.Concat(persister.PropertyNames)
57+
.ToArray();
5158
}
5259

5360
private AbstractEntityPersister GetAbstractEntityPersister(Type entityType)

0 commit comments

Comments
 (0)