bakspamshooth
New Member
I've got a simple WebApi method like this decorated with the OData queryable attribute.\[code\] [Queryable] public virtual IQueryable<PersonDto> Get() { return uow.Person().GetAll()); // Currently returns Person instead of PersonD }\[/code\]What I want to do is transform the result of the query from type Person to type PersonDto using AutoMapper before WebAPI converts the result to JSON.Does anybody know how I can do this? I am aware, I could apply Mapper.Map after the GetAll() call and then convert back to IQueryable, however this would result in the entire table being returned and mapped before the OData filter is applied (not good!).It would appear that this question ASP.NET Web API return queryable DTOs? covers the same issue (see second response for a better answer), where the suggestion is to use AutoMapper at the end of the chain using a custom MediaTypeFormatter, however I have no idea how to do that based on the example I have seen.Any help will be gratefully received!