Double linked navigation property in OData RRS feed

  • Question

  • Our database consists of multiple tables sharing the same identity key, for example:


    • ID (serial, PK)
    • Name


    • PersonID (int, PK, FK reference Person.ID)
    • Address

    When the database is modeled using EF, navigation properties is created, i.e. Person.Customer, Customer.Person. This model is then served using WCF Data Service.

    Now on the OData client side, what's the best way to query for the entities so that both navigation property is populated? The following would work:


    And the resulting entity reference is correct, i.e. ReferenceEquals(person, person.Customer.Person) == true, which is good.

    But when viewing the corresponding XML result, the same Person entity is being transferred twice: once in the main, another in the inline entry under the Customer. This seems to be a waste of bandwidth. Is there a better way to do it?

    Friday, May 18, 2012 9:45 PM


  • I would suggest won`t fix cost of fixing will higher than benefit obtained because if you are building  LOB application cost of another round trip will not be too much  alternatively use caching  i.e. query one and load in POCO object and reuse them (not a recommended)

    Sunday, May 20, 2012 11:55 AM