I have classes EntityA to DtoA and 2 usages of automapper in my .NET project.
First one is:
var result1 = dbContext
.Set<EntityA>()
.Where(...)
.ProjectTo<DtoA>(new { param1 = true } )
.ToList();
And the second:
var aList = dbContext
.Set<EntityA>()
.Where(...)
.ToList();
var result = Mapper
.Map<DtoA[]>(aList, options => options.Items["param1"] = true);
I want to have a reusable mapping working for both cases. This mapping has to be conditional for some fields based on param1 value. How to implement it within single CreateMap<,>().ForMember() API ?