locked
Is there a way to identify an inline entry RRS feed

  • Question

  • Hi all:

    http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$select=Name,Products/Name works great for us as it has a feed for the Products/Name part.

    http://services.odata.org/OData/OData.svc/Products?$expand=Category&$select=Name,Category/Name is a problem because the Category/Name part is not in a feed.

    Is there any way to know when we're getting an inner entry with no feed around it? Does the ODataEntry object have a value we can look at?

    thanks - dave


    Who will win The International Collegiate Programming Championships?

    Wednesday, September 26, 2012 8:37 PM

Answers

  • Hi,

    Assuming you're reading the payload using ODataMessageReader and ODataReader. In the first case you will see these events:

    FeedStart (the outer Categories)
      EntryStart (Category)
        NavigationLinkStart (Products navigation property)
          FeedStart (inner products)
            EntryStart (Product)
            EntryEnd (Product)
            EntryStart (Product 2)
            EntryEnd (Product 2)
          FeedEnd (inner products)
        NavigationLinkEnd (Products)
      EntryEnd (Category)
      EntryStart (Category)
        ...

    But for the second URL the events will be like

    FeedStart (Products)
      EntryStart (Product)
        NavigationLinkStart (Category)
          EntryStart (Category)
          EntryEnd (Category)
        NavigationLinkEnd (Category)
      EntryEnd (Product)
      EntryStart (Product 2)
         ...

    The difference is that if the expanded navigation property is a collection, there will be a feed inside the navigation link. If it's a singleton, there will be just the single entry.

    There's also a property on the ODataNavigationLink.IsCollection, but it will only be reliably populated if you're using metadata (you passed in the IEdmModel to the reader), otherwise it might get populated after the start was reported.

    Thanks,


    Vitek Karas [MSFT]

    • Marked as answer by DavidThielen Friday, September 28, 2012 2:57 PM
    Thursday, September 27, 2012 4:43 AM
    Moderator

All replies

  • Hi,

    Assuming you're reading the payload using ODataMessageReader and ODataReader. In the first case you will see these events:

    FeedStart (the outer Categories)
      EntryStart (Category)
        NavigationLinkStart (Products navigation property)
          FeedStart (inner products)
            EntryStart (Product)
            EntryEnd (Product)
            EntryStart (Product 2)
            EntryEnd (Product 2)
          FeedEnd (inner products)
        NavigationLinkEnd (Products)
      EntryEnd (Category)
      EntryStart (Category)
        ...

    But for the second URL the events will be like

    FeedStart (Products)
      EntryStart (Product)
        NavigationLinkStart (Category)
          EntryStart (Category)
          EntryEnd (Category)
        NavigationLinkEnd (Category)
      EntryEnd (Product)
      EntryStart (Product 2)
         ...

    The difference is that if the expanded navigation property is a collection, there will be a feed inside the navigation link. If it's a singleton, there will be just the single entry.

    There's also a property on the ODataNavigationLink.IsCollection, but it will only be reliably populated if you're using metadata (you passed in the IEdmModel to the reader), otherwise it might get populated after the start was reported.

    Thanks,


    Vitek Karas [MSFT]

    • Marked as answer by DavidThielen Friday, September 28, 2012 2:57 PM
    Thursday, September 27, 2012 4:43 AM
    Moderator
  • Friday, September 28, 2012 2:58 PM