BeforeMap not called with open generic #4047
Answered
by
lbargaoanu
sebastiencozzi
asked this question in
Q&A
-
Source/destination typesCustomList to List Mapping configuration cfg.CreateMap(typeof(ModifiableList<>), typeof(List<>))
.BeforeMap((a, b) =>//Never called
{
Type t = a.GetType();
if(t == typeof(int))
{
throw new InvalidOperationException("A is an int");
}
else
{
throw new InvalidOperationException("A isn't an int");
}
return;
})
.ConvertUsing(typeof(ModifiableListConverter<,>))
; Version: 11.0.1.NET 6 with automapper 11.0.1 Expected behaviorThe BeforeMap callback is called before the TypeConverter Actual behaviorThe BeforeMap callback is not called Steps to reproducehttps://gist.github.com/sebastiencozzi/b4a667d0965d422c7689d3cb855758d8#file-beforemapopengeneric |
Beta Was this translation helpful? Give feedback.
Answered by
lbargaoanu
Aug 25, 2022
Replies: 1 comment
-
That's expected. Type converters don't mix with other configuration. You're, in fact, taking over the mapping. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lbargaoanu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's expected. Type converters don't mix with other configuration. You're, in fact, taking over the mapping.