Search code examples
c#entity-frameworkmappingautomapperaspnetboilerplate

Automapper 8 does not map two entities with same properties without config


Previously, in version 7, i have written lots of mapping from inputdto to entity without config, but in version 8 i have to write empty config for these types of mappings, how can i avoid this?


Solution

  • In asp.net boilerplate, you can use the AutoMap Attribute to define mappings without having to write the configurations explicitly.

    [AutoMap(typeof(User))]
    public class UserDto
    

    Here is the reference to it