Skip to content

Commit 92133f0

Browse files
chris-petersonhazzik
authored andcommitted
Allow customizing 'alias to bean' property not found behavior (#2287)
1 parent 77738a0 commit 92133f0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/NHibernate/Transform/AliasToBeanResultTransformer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public override IList TransformList(IList collection)
109109
return collection;
110110
}
111111

112+
protected virtual void OnPropertyNotFound(string propertyName)
113+
{
114+
throw new PropertyNotFoundException(_resultClass.GetType(), propertyName, "setter");
115+
}
116+
112117
#region Setter resolution
113118

114119
/// <summary>
@@ -136,7 +141,7 @@ private void SetProperty(string alias, object value, object resultObj)
136141
if (TrySet(alias, value, resultObj, _fieldsByNameCaseInsensitive))
137142
return;
138143

139-
throw new PropertyNotFoundException(resultObj.GetType(), alias, "setter");
144+
OnPropertyNotFound(alias);
140145
}
141146

142147
private bool TrySet(string alias, object value, object resultObj, Dictionary<string, NamedMember<FieldInfo>> fieldsMap)

0 commit comments

Comments
 (0)