You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mapping.IgnoreProperty (x => x.IsOverriden) does not ignore properties that are overriden in sub-classes.
Further more, it cannot ignore properties that are overriden in sub-classes.
Ideally I think auto-mapping should ignore properties in sub-classes that are already mapped by a super-class rather than mapping the same property twice.
Cases
super-class is not mapped, thus property is not mapped, sub-class must define the property.
super-class is mapped, thus the property is mapped, sub-class must not define the property.
super-class is mapped but property was ignored, thus property is not mapped, sub-class must define the property.
super-class is mapped but property was ignored for all sub-classes, thus property is not mapped, sub-class must not define the property.
3 could be optional if 4 is always assumed. I.E. ignores are always inherited, though this would be a breaking change.
4 would require adding an extra ignore method to AutoMapping<T>, e.g. mapping.IgnorePropertyForAllSubClasses (x => x.IsOverriden)
It might also be worth while looking at how inheritance as a whole is handled rather than just ignoring properties as a similar problem occurs when declaring a super-class' abstract property as Access.ReadOnly(), you then have to ignore that property from each of the sub-classes.
Fwiw, we have the exact problem. We want our overridden property in base class and subclasses ignored. While it ignores in base class, it doesn't in subclasses.
I understand the problem, but I'm not sure how to approach this. Also, breaking change isn't a good idea for a minor release. If only @jagregory can give some advice
mapping.IgnoreProperty (x => x.IsOverriden)
does not ignore properties that are overriden in sub-classes.Further more, it cannot ignore properties that are overriden in sub-classes.
Eg
This partially works, it will ignore
ItemBase.IsOverriden
but notItem.IsOverriden
This does not work, Item.IsOverriden will not be ignored.
As a work around the following does work:
The following example reproduces the error with FNH 1.3.0.717 and earlier: https://gist.github.com/1358583
Example Result (cleaned up a little)
The text was updated successfully, but these errors were encountered: