public override void WriteStart(DataServiceODataWriterFeedArgs args) { base.WriteStart(args); foreach (var annotation in CustomInstanceAnnotationsGenerator.GetDuplicateAnnotations()) { args.Feed.InstanceAnnotations.Add(annotation); } }
public override void WriteStart(DataServiceODataWriterFeedArgs args) { CustomInstanceAnnotationsDescriptor current; if (writtenItemsStack.Count == 0) { current = new CustomInstanceAnnotationsDescriptor { TypeOfAnnotatedItem = typeof(ODataFeed), Parent = null, AnnotationsOnStart = new Collection<ODataInstanceAnnotation>(CustomInstanceAnnotationsGenerator.GetAnnotations("AnnotationOnFeed.AddedBeforeWriteStart.").Concat(CustomInstanceAnnotationsGenerator.GetAnnotationsWithTermInMetadata()).ToList()), AnnotationsOnEnd = new Collection<ODataInstanceAnnotation>(CustomInstanceAnnotationsGenerator.GetAnnotations("AnnotationOnFeed.AddedAfterWriteStart.").ToList()), }; } else { current = new CustomInstanceAnnotationsDescriptor { TypeOfAnnotatedItem = typeof(ODataFeed), Parent = writtenItemsStack.Peek(), AnnotationsOnEnd = new Collection<ODataInstanceAnnotation>(), AnnotationsOnStart = new Collection<ODataInstanceAnnotation>() }; } AnnotatedItemsBaseline.Add(current); writtenItemsStack.Push(current); foreach (var annotation in current.AnnotationsOnStart) { args.Feed.InstanceAnnotations.Add(annotation); } base.WriteStart(args); foreach (var annotation in current.AnnotationsOnEnd) { args.Feed.InstanceAnnotations.Add(annotation); } }
/// <summary> /// Finish writing a feed. /// </summary> /// <param name="args">DataServiceODataWriterFeedArgs which contains the ODataFeed and the collection instance that is being serialized.</param> /// <remarks> /// This method calls WriteEnd() and it's used to track when WriteEnd is called for feed. /// </remarks> public virtual void WriteEnd(DataServiceODataWriterFeedArgs args) { WebUtil.CheckArgumentNull(args, "args"); this.WriteEnd(); }
/// <summary> /// Start writing a feed. /// </summary> /// <param name="args">DataServiceODataWriterFeedArgs which contains the ODataFeed and the collection instance to serialize.</param> public virtual void WriteStart(DataServiceODataWriterFeedArgs args) { WebUtil.CheckArgumentNull(args, "args"); this.innerWriter.WriteStart(args.Feed); }
public override void WriteEnd(DataServiceODataWriterFeedArgs args) { if (WriteFeedEnd.Value != null) { if (WriteFeedEnd.Value(args)) return; } base.WriteEnd(args); }