Проблемы с отображением списков после обновления с 7.0.1 до 8.1.1? - PullRequest
0 голосов
/ 14 апреля 2020

Мне было поручено обновить автомаппер. В настоящее время мы находимся на версии 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. Кто-нибудь знает в чем проблема?

...