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);
            }
        }
예제 #3
0
 /// <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();
 }
예제 #4
0
 /// <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);
 }
예제 #5
0
 /// <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();
 }
예제 #6
0
 /// <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);
 }
예제 #7
0
            public override void WriteEnd(DataServiceODataWriterFeedArgs args)
            {
                if (WriteFeedEnd.Value != null)
                {
                    if (WriteFeedEnd.Value(args)) return;
                }

                base.WriteEnd(args);
            }