I get the following error when using the DTO and EF model:
Unable to start an object of type "System.Collections.Generic.List 1[Project.Core.UI.Models.ContentTypes]'
to type 'System.Linq.IQueryable1 [Project.Core.UI.Models.ContentTypes]
Uploaded: Mapper.CreateMap<ContentType, Project.Core.UI.Models.ContentTypes>();
In the OData controller method public IQueryable<ContentTypes> Get() {...}, using:
var result = Mapper.Map<IQueryable<ContentType>, IQueryable<ContentTypes>>(_repository.Query().Get()
.Where(u => u.UserId == userId)
.OrderBy(o => o.Description));
I also tried the following, but I suspect that this is exactly what is stated above:
var result =_repository.Query().Get()
.Where(u => u.UserId == userId)
.OrderBy(o => o.Description);
var dto = Mapper.Map<IQueryable<ContentType>, IQueryable<ContentTypes>>(result);
return dto;
How can I create an appropriate mapping for this?
source
share