How to use AutoMapper .ForMember?

Try the following syntax:

Mapper
    .CreateMap<Entity, EntityDto>()
    .ForMember(
        dest => dest.SomeDestinationProperty,
        opt => opt.MapFrom(src => src.SomeSourceProperty)
    );

or if the source and destination properties have the same names simply:

Mapper.CreateMap<Entity, EntityDto>();

Please checkout the relevant sections of the documentation for more details and other mapping scenarios.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)