I'm trying to map IQueryable< entity> to IQueryable< entityDTO> using Automapper for generating Linq. I'm working on a Web API project w/ entity framework and oracle 11g.
public virtual IQueryable<TDto> Get()
{
IQueryable<TEntity> EntObjs;
EntObjs = GenericService.Get();
var Dtos = EntObjs.Project().To<TDto>();
return Dtos;
}
It works fine as long as the Tentity type does not have any Collections in it. I found info at http://www.devtrends.co.uk/blog/stop-using-automapper-in-your-data-access-code that has got be halfway to solving the problem. I know I can map the collections with Automapper using the follow function, but I need it to be in linq so I do not break the Iquerable chain.
Mapper.Map<TSource, TDestination>(Source,Destincation);