c# - AutoMapper generic map method does not map enum values -
i have generic mapper function mapping between view models , domain models. reason, not map enum values.
public tdomainmodel maptodomainmodel<tviewmodel, tdomainmodel>(tviewmodel viewmodel) { mapper.createmap<tviewmodel, tdomainmodel>(); tdomainmodel result = mapper.map<tviewmodel, tdomainmodel>(viewmodel); return result; } public tviewmodel maptoviewmodel<tdomainmodel, tviewmodel>(tdomainmodel domainmodel) { mapper.createmap<tdomainmodel, tviewmodel>(); tviewmodel result = mapper.map<tdomainmodel, tviewmodel>(domainmodel); return result; }
i need map enum values integers when mapping view model domain model. , map integers enum values when mapping domain models view models.
it great if solution flexible enough convert nullable enums more types (short, byte etc) , vice versa.
Comments
Post a Comment