$expand/$select is not applied for OData controller implementation unless you call ODataQueryOptions.ApplyTo()

May 7, 2014 at 7:20 PM
Edited May 7, 2014 at 7:25 PM
Hi Le,

How do you use expand and select with PageResult? Do you have any wrapper?
Please check the following link $expand/$select is not applied for OData
    public PageResult<ResultFromExpandSelect> GetRecord(ODataQueryOptions<Record> options)
            var queryable = _customRepository.ODataQueryable(options);

            var pageResult = new PageResult<ResultFromExpandSelect>(
                queryable as IEnumerable<ResultFromExpandSelect>, 

            return pageResult;
Note: The following case works, but is not using PageResult.
        public IQueryable<Customer> GetCustomer( )
            var uri = _uri.AbsoluteUri;
            return _customerService.ODataQueryable();
May 7, 2014 at 9:31 PM
That has been obsolete, please use the following for OData:
       // GET: odata/Customers
        public IQueryable<Customer> GetCustomer()
            return _customerService.ODataQueryable();
Marked as answer by lelong37 on 5/7/2014 at 1:31 PM
May 8, 2014 at 9:59 AM
Do you have any sample injecting multiple Context using Unity?

Thanks again,