Emit Mapper Flattering with Custom Converters

∥☆過路亽.° 提交于 2019-12-12 02:27:37

问题


With this configuration for some reason Conver function of Custom Converter is not called when using FlatteringConfig from EmitMapper Samples. It is called, when DefaultMapConfig is used.

The configuration:

    var userMapper = ObjectMapperManager.DefaultInstance.GetMapper<User, UserModel>(
                   new FlatteringConfig().ConvertGeneric(typeof(IList<>), typeof(IList<>),
                new DefaultCustomConverterProvider(typeof(EntityListToModelListConverter<,>))));

Any ideas about the potential reason?

Solution

Look at my answer below


回答1:


Because FlatteringConfig overrides GetMappingOperations function it is not calling FilterOpertations functions, which assigns custom converters. So adding FilterOperations function call to the GetMappingOperations solved the problem.



来源:https://stackoverflow.com/questions/9632519/emit-mapper-flattering-with-custom-converters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!