Service Operations and eager loading RRS feed

  • Question

  • Hi Guys,


    I have the following Service operation that intends to load products and its related ProductCategory objects.


      public IQueryable<Product> GetProducts(string productName, int productCategoryId)
                return from p in this.CurrentDataSource.Product.Include("ProductCategory")                 
                       select p;


    When I consume it from Javascript, it does retrieve the Product objects, but it does not include the ProductCategory objects assosiated to each Product.


    Any Ideas??




    Thursday, February 7, 2008 8:53 PM


  • Adrian, there is currently no way to specify the expansion option on the server side. We'll look into options for doing this, but for the time being you should be able to simply request an $expand option from the client, and because the service operation is an IQueryable, the expansion should apply.




    Tuesday, February 12, 2008 8:36 PM