My question is very similar to this one: How do I map an OData query against a DTO to an EF entity? I have a simple setup to test the ASP.NET Web API OData V4 $filter functi
Try using AutoMapper, you will need to add these references to your controller
using AutoMapper;
using AutoMapper.QueryableExtensions;
Your method
[EnableQuery(AllowedQueryOptions = AllowedQueryOptions.All)]
public IQueryable Get()
{
return dbContext.Entities.ProjectTo();
}
In your global
protected void Application_Start()
{
//Usually in a diff class Mapping.ConfigureDataTransferObjects();
Mapper.CreateMap();
Mapper.CreateMap();
}