I have e.g. the following code that queries a list of DTOs, and maps that to a list of viewmodels. I would like to have my container resolve these viewmodels, instead of AutoMapper simply instantiating them without any injection.
using (var db = new AppDbContext())
{
var types = await db.ApptTypes
.Where(t => t.BranchId == branchId && (includeDeleted || !t.IsDeleted))
.Include(e => e.CreatedBy)
.Include(e => e.CreatedAt)
.Include(e => e.Org)
.Include(e => e.Branch)
.ToListAsync(cancellationToken);
return Mapper.Map<IEnumerable<ApptTypeDetailViewModel>>(types);
}