Я пытаюсь повысить производительность моего API с помощью Autopper.Я создал целевой DTO, и у меня уже есть источник mnodel.Я также создал отображение, но когда я отображаю эту ошибку.
The type arguments for method 'Enumerable.Select<TSource, TResult>
(IEnumerable<TSource>, Func<TSource, TResult>)' cannot be inferred from the
usage. Try specifying the type arguments explicitly.
См. Пример кода ниже
[Route("StaffInfo/{*job_title}")]
public IHttpActionResult GetStaffInfoByTitle(string job_title)
{
var rStructure = _context.employeeinfo.Where(e => e.jobtitle.Contains(job_title)).ToList()
.Select(Mapper.Map<employeeinfo, employeeinfoDto>);
if (rStructure == null)
{
return NotFound();
}
return Ok(rStructure);
}
Модель DTO
public class employeeinfoDto
{
public string employee_number { get; set; }
public string name { get; set; }
public string companyname { get; set; }
public int employee_id { get; set; }
public Byte? linemanager { get; set; }
}
Модель Домиана
public class employeeinfo
{
public string employee_number { get; set; }
public string name { get; set; }
public string companyname { get; set; }
public int employee_id { get; set; }
public Byte? linemanager { get; set; }
}
Отображение профиля
Mapper.CreateMap<employeeinfo, employeeinfoDto>();