I am new to AutoMapper and wanting to setup for two properties to map but the other 15 ignore.
My research and reading such as here indicates 3 options.
Use Ignore() such as: (currently do and it works but is bloated)
d => d.IgnoreMe, opt => opt.Ignore()
Annotate with [IgnoreMapAttribute]. Wish I could but the object is not mine to tweak.
Extension Method such as seen here answer posted by Rami A(I would have to tweak it)
However it seemed to me these options are work arounds and I am just not using AutoMapper properly?
What I am looking for is something like:
Mapper.CreateMap<Customer, DropPointModel>()
.ForMember(dest => dest.CustomerId,
opts => opts.MapFrom(src => src.Id))
.ForMember(dest => dest.VendorId,
opts => opts.MapFrom(src => src.VendorId))
.IgnoreAllOtherMappings();
Does something along these lines exist in AutoMapper and I'm not implementing correctly or am I correct and just need to write the extension method. If the latter I will post back here for others.