I am trying to map one entity to another (which has one additional field).
Group {
int Id;
}
GroupExtended {
int Id;
string Description;
}
So I do the mapping in loop:
foreach (var group in groups)
{
var result = mapper.Map<Group, GroupExtended>(group,
opt => opt.AfterMap((src, dest) => dest.Description = someValue));
}
Is that possible to map entire IEnumerable, and still passing an the value ?
I tried this:
var result = mapper.Map<List<GroupExtended>>(groups,
opt => opt.AfterMap((src, dest) => dest.Description = someValue));
But it has an error on dest.Description
: 'object' does not contain definition of "Description"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…