Attaching related data to an entity returned by a sproc RRS feed

  • Question

  • Let's say I have a table/entity called Customers, which has many Invoices. The query to get the Customers
    I need to is extremely complex and needs to done from a sproc.

    I want to serve this data via ado.net data services to return the customers but also their related Invoices.

    If it was just done via data services I could express this as

    dim c = (from t in ctx.Customers.Expand("Invoices") where customerid = 1)

    If I have got the Customer data via a sproc how do I get the Invoice data to attach to the Customer data.

    I have posted to both groups as it applies to EF and data services.

    Regards, Chris. 

    Tuesday, January 27, 2009 5:18 PM


  • you can check out the following blog etnry which discuss service operations (sprocs)



    http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'&$expand=Order_Details&$orderby=RequiredDate desc

    As long as the sproc returns IQueriable<Entity> you should be able to expand

    public DataServiceQuery<Customer> CustomersByCity(string city)
    if (city == null)
    throw new ArgumentNullException("city ");
    return this.CreateQuery<Customer>("CustomersByCity").AddQueryOption("city","'"+city+"'");

    Monday, April 25, 2011 3:12 PM