private MaterializerEntry ReadEntryCore() { MaterializerEntry entry2; this.ExpectState(ODataReaderState.EntryStart); ODataEntry item = (ODataEntry)this.reader.Item; if (item == null) { entry2 = MaterializerEntry.CreateEmpty(); this.ReadAndExpectState(ODataReaderState.EntryEnd); return(entry2); } entry2 = MaterializerEntry.CreateEntry(item, this.responseInfo.MaxProtocolVersion); do { this.AssertRead(); switch (this.reader.State) { case ODataReaderState.EntryEnd: break; case ODataReaderState.NavigationLinkStart: entry2.AddNavigationLink(this.ReadNavigationLink()); break; default: throw System.Data.Services.Client.Error.InternalError(InternalError.UnexpectedReadState); } }while (this.reader.State != ODataReaderState.EntryEnd); entry2.UpdateEntityDescriptor(); return(entry2); }
/// <summary> /// Reads the remainder of an entry. /// </summary> /// <returns>An entry.</returns> private MaterializerEntry ReadEntryCore() { this.ExpectState(ODataReaderState.EntryStart); ODataEntry result = (ODataEntry)this.reader.Item; MaterializerEntry entry; List <ODataNavigationLink> navigationLinks = new List <ODataNavigationLink>(); if (result != null) { entry = MaterializerEntry.CreateEntry( result, this.readODataFormat, this.mergeOption != MergeOption.NoTracking, this.clientEdmModel); do { this.AssertRead(); switch (this.reader.State) { case ODataReaderState.NavigationLinkStart: // Cache the list of navigation links here but don't add them to the entry because all of the key properties may not be available yet. navigationLinks.Add(this.ReadNavigationLink()); break; case ODataReaderState.EntryEnd: break; default: throw DSClient.Error.InternalError(InternalError.UnexpectedReadState); } }while (this.reader.State != ODataReaderState.EntryEnd); entry.UpdateEntityDescriptor(); } else { entry = MaterializerEntry.CreateEmpty(); this.ReadAndExpectState(ODataReaderState.EntryEnd); } // Add the navigation links here now that all of the property values have been read and are available to build the links. foreach (ODataNavigationLink navigationLink in navigationLinks) { entry.AddNavigationLink(navigationLink); } return(entry); }