Skip to content

Commit ffd01eb

Browse files
committed
Mapping/Map.cs: Give a helpful message if user doesn't specify collection-type for a sorted generic map, instead of NullReferenceException.
1 parent d999a16 commit ffd01eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/NHibernate/Mapping/Map.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public override CollectionType CollectionType
3131
if (IsGeneric && IsSorted)
3232
{
3333
CheckGenericArgumentsLength(2);
34-
if (TypeName.Contains("sorted-list"))
34+
if (TypeName != null && TypeName.Contains("sorted-list"))
3535
{
3636
return
3737
TypeFactory.GenericSortedList(Role, ReferencedPropertyName, Comparer, GenericArguments[0], GenericArguments[1]);
3838
}
39-
else if (TypeName.Contains("sorted-dictionary"))
39+
else if (TypeName != null && TypeName.Contains("sorted-dictionary"))
4040
{
4141
return
4242
TypeFactory.GenericSortedDictionary(Role, ReferencedPropertyName, Comparer, GenericArguments[0],
@@ -45,7 +45,7 @@ public override CollectionType CollectionType
4545
else
4646
{
4747
throw new MappingException(
48-
"Use collection-type='sorted-list/sorted-dictionary' to choose implementation for generic map");
48+
"Use collection-type='sorted-list/sorted-dictionary' to choose implementation for generic map owned by " + this.OwnerEntityName);
4949
}
5050
}
5151
return base.CollectionType;

0 commit comments

Comments
 (0)