petrov.alex
petrov.alex

Reputation: 1089

Emit Mapper Flattering with Custom Converters

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

Upvotes: 0

Views: 1388

Answers (1)

petrov.alex
petrov.alex

Reputation: 1089

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.

Upvotes: 0

Related Questions