Skip to content

Commit 86c3f66

Browse files
committed
Fixes issue
1 parent 81efb59 commit 86c3f66

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/NHibernate/Persister/Entity/AbstractPropertyMapping.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ protected QueryException PropertyException(string propertyName)
3232

3333
public IType ToType(string propertyName)
3434
{
35-
IType type;
36-
if (!typesByPropertyPath.TryGetValue(propertyName, out type))
35+
if (!typesByPropertyPath.TryGetValue(propertyName, out var type))
3736
throw PropertyException(propertyName);
3837

3938
return type;
@@ -94,11 +93,16 @@ public virtual string[] ToColumns(string propertyName)
9493

9594
protected void AddPropertyPath(string path, IType type, string[] columns, string[] formulaTemplates)
9695
{
97-
typesByPropertyPath[path] = type;
98-
columnsByPropertyPath[path] = columns;
96+
if (!typesByPropertyPath.ContainsKey(path))
97+
{
98+
typesByPropertyPath[path] = type;
99+
columnsByPropertyPath[path] = columns;
99100

100-
if (formulaTemplates != null)
101-
formulaTemplatesByPropertyPath[path] = formulaTemplates;
101+
if (formulaTemplates != null)
102+
{
103+
formulaTemplatesByPropertyPath[path] = formulaTemplates;
104+
}
105+
}
102106
}
103107

104108
protected internal void InitPropertyPaths( string path, IType type, string[] columns, string[] formulaTemplates, IMapping factory )

0 commit comments

Comments
 (0)