locked
Lazy loading at WCF client RRS feed

  • Question

  • Hey guys.
    So now we have implicit lazy loading enabled in ADO EF. The problem in question is whether it is possible to have implicit lazy loading out of the box for the WCF client?

    E.g. have a valid code like this:
    List<Customer> customers = wcfService.GetCustomers();
    List<Order> orders = customers[0].Orders; // here orders are lazy loaded for the first customer
    
    
    
    Friday, November 6, 2009 12:01 PM

Answers

  • Hi Andrey,

    No this is not possible and it is not in the plans, although I think you could build this capability yourself in your entity and collection types.

    Besides, in my opinion, since a connection to a web service typically has high latency, lazy loading in this scenario might have more perils than benefits: you might end up in an application that uses a lot of lazy loading because lazy loading makes it look as easy as just dereferencing a property on an object, but under the hood every time you do it an expensive round-trips to the service is being initiated.

    Thanks,
    Diego


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, November 6, 2009 8:03 PM
    Moderator