private void WriteEntry(ODataWriter writer, ODataItem entry) { ODataResource resource = entry as ODataResource; if (resource != null) { writer.WriteStart(resource); } else { writer.WritePrimitive((ODataPrimitiveValue)entry); } var annotation = entry.GetAnnotation <ODataEntryNavigationLinksObjectModelAnnotation>(); ODataNestedResourceInfo navLink = null; if (annotation != null) { for (int i = 0; i < annotation.Count; ++i) { bool found = annotation.TryGetNavigationLinkAt(i, out navLink); ExceptionUtilities.Assert(found, "Navigation links should be ordered sequentially for writing"); this.WriteNavigationLink(writer, navLink); } } writer.WriteEnd(); }
protected static void AddChildInstanceAnnotations(ODataItem item, IList <object> childEntries) { var annotation = item.GetAnnotation <ChildInstanceAnnotation>(); if (annotation == null) { annotation = new ChildInstanceAnnotation { ChildInstances = childEntries }; item.SetAnnotation(annotation); } }
private void AddChildInstanceAnnotation(ODataItem item, object childEntry) { var annotation = item.GetAnnotation <ChildInstanceAnnotation>(); if (annotation == null) { annotation = new ChildInstanceAnnotation { ChildInstances = new List <object>() }; item.SetAnnotation(annotation); } annotation.ChildInstances.Add(childEntry); }
private void AddBoundNavigationPropertyAnnotation(ODataItem item, ODataNestedResourceInfo navigationLink, object boundValue) { var annotation = item.GetAnnotation <BoundNavigationPropertyAnnotation>(); if (annotation == null) { annotation = new BoundNavigationPropertyAnnotation { BoundProperties = new List <Tuple <ODataNestedResourceInfo, object> >() }; item.SetAnnotation(annotation); } annotation.BoundProperties.Add(new Tuple <ODataNestedResourceInfo, object>(navigationLink, boundValue)); }
private void WriteEntry(ODataWriter writer, Lazy <ODataReader> lazyReader, ODataItem entry) { this.WriteStart(writer, entry); var annotation = entry.GetAnnotation <ODataEntryNavigationLinksObjectModelAnnotation>(); ODataNestedResourceInfo navLink = null; if (annotation != null) { for (int i = 0; i < annotation.Count; ++i) { bool found = annotation.TryGetNavigationLinkAt(i, out navLink); ExceptionUtilities.Assert(found, "Navigation links should be ordered sequentially for writing"); this.WriteNavigationLink(writer, lazyReader, navLink); } } this.WriteEnd(writer, ODataReaderState.ResourceEnd); this.Read(lazyReader); }
private void AddChildInstanceAnnotation(ODataItem item, object childEntry) { var annotation = item.GetAnnotation<ChildInstanceAnnotation>(); if (annotation == null) { annotation = new ChildInstanceAnnotation { ChildInstances = new List<object>() }; item.SetAnnotation(annotation); } annotation.ChildInstances.Add(childEntry); }
private void AddBoundNavigationPropertyAnnotation(ODataItem item, ODataNavigationLink navigationLink, object boundValue) { var annotation = item.GetAnnotation<BoundNavigationPropertyAnnotation>(); if (annotation == null) { annotation = new BoundNavigationPropertyAnnotation { BoundProperties = new List<Tuple<ODataNavigationLink, object>>() }; item.SetAnnotation(annotation); } annotation.BoundProperties.Add(new Tuple<ODataNavigationLink, object>(navigationLink, boundValue)); }