代码之家  ›  专栏  ›  技术社区  ›  coding4fun

从7.0.1升级到8.1.1后是否出现映射列表问题?

  •  0
  • coding4fun  · 技术社区  · 5 年前

    我的任务是升级自动机。我们目前在版本 7.0.1 我正在升级到 8.1.1 我对自动售货机一窍不通,所以请耐心听我说。完成升级并拨打电话后 mc.AssertConfigurationIsValid(); 我得到以下类型的错误:

    {"The following member on Trs.Gemini.EmployerService.Models.Cba.TaskListDto cannot be mapped: \n\tTasks \nAdd a custom mapping expression, ignore, add a custom resolver, or modify the destination type Trs.Gemini.EmployerService.Models.Cba.TaskListDto.\nContext:\n\tMapping to member Tasks from Trs.Gemini.EmployerService.Api.UseCases.Cba.Queries.GetTrsUserTaskListResult to Trs.Gemini.EmployerService.Models.Cba.TaskListDto\nException of type 'AutoMapper.AutoMapperConfigurationException' was thrown."}
    {"The following member on Trs.Gemini.EmployerService.Models.Cba.TaskListDto cannot be mapped: \n\tTasks \nAdd a custom mapping expression, ignore, add a custom resolver, or modify the destination type Trs.Gemini.EmployerService.Models.Cba.TaskListDto.\nContext:\n\tMapping to member Tasks from Trs.Gemini.EmployerService.Api.UseCases.Cba.Queries.GetEmployerTaskListResult to Trs.Gemini.EmployerService.Models.Cba.TaskListDto\nException of type 'AutoMapper.AutoMapperConfigurationException' was thrown."}
    
    CreateMap<GetTrsUserTaskListResult, TaskListDto>(MemberList.Source)
                    .ForMember(x => x.Tasks, opt => opt.MapFrom(y => y.TrsUserTaskResults));
    
                CreateMap<GetEmployerTaskListResult, TaskListDto>(MemberList.Source)
                    .ForMember(x => x.Tasks, opt => opt.MapFrom(y => y.EmployerTaskResults));
    
        public class GetTrsUserTaskListResult
        {
            public GetTrsUserTaskListResult()
            {
                TrsUserTaskResults = new List<GetTaskResult>();
            }
    
            public Guid? TrsUserKey { get; set; }
            public List<GetTaskResult> TrsUserTaskResults { get; set; }
            public int TotalResultsCount { get; set; }
            public int FilteredResultsCount { get; set; }
        }
    
        public class TaskListDto
        {
            public TaskListDto()
            {
                Tasks = new List<TaskDto>();
            }
    
            public Guid? TrsUserKey { get; set; }
            public List<TaskDto> Tasks { get; set; }
            public int TotalResultsCount { get; set; }
            public int FilteredResultsCount { get; set; }
        }
    
        public class GetEmployerTaskListResult
        {
            public GetEmployerTaskListResult()
            {
               EmployerTaskResults = new List<GetTaskResult>();
            }
            public List<GetTaskResult> EmployerTaskResults { get; set; }
    
            public int TotalResultsCount { get; set; }
            public int FilteredResultsCount { get; set; }
        }
    

    这只是一个样本。这类错误更多,但共同的主题似乎是,它似乎总是 List<x> 在它有问题的底层类中。这段代码在7.0.1中运行良好。有人知道问题是什么吗?

    0 回复  |  直到 5 年前