automapper的配置是这样的:Mapper.Initialize(cfg => cfg.CreateMap<ApiOutputDto, ApiPagingOutputDto<Class1>>());
调用是这样的:AutoMapper.Mapper.Map<ApiPagingOutputDto<Class1>>(result);
运行时报错:Missing type map configuration or unsupported mapping.
其他不带泛型的转换都是正常的:(
public class ApiOutputDto : IApiOutput { public string RespCode { get; set; } public string RespMSG { get; set; } }
public class ApiPagingOutputDto<T> : ApiOutputDto where T : class, new() { public int TotalCount { get; set; } public IEnumerable<T> Data { get; set; } }
是automapper修改了映射地图配置方式
Dynamically creating maps will be removed in version 5.0. Use a MapperConfiguration instance and store statically as needed, or Mapper.Initialize. Use CreateMapper to create a mapper instance.