public override void WriteStart(DataServiceODataWriterEntryArgs args)
 {
     base.WriteStart(args);
     foreach (var annotation in CustomInstanceAnnotationsGenerator.GetDuplicateAnnotations())
     {
         args.Entry.InstanceAnnotations.Add(annotation);
     }
 }
        public override void WriteStart(DataServiceODataWriterEntryArgs args)
        {
            CustomInstanceAnnotationsDescriptor current = new CustomInstanceAnnotationsDescriptor
            {
                TypeOfAnnotatedItem = typeof(ODataEntry),
                Parent = writtenItemsStack.Count == 0 ? null : writtenItemsStack.Peek(),
                AnnotationsOnStart = new Collection<ODataInstanceAnnotation>(CustomInstanceAnnotationsGenerator.GetAnnotations("AnnotationOnEntry.AddedBeforeWriteStart.").ToList()),
                AnnotationsOnEnd = new Collection<ODataInstanceAnnotation>(CustomInstanceAnnotationsGenerator.GetAnnotations("AnnotationOnEntry.AddedAfterWriteStart.").Concat(CustomInstanceAnnotationsGenerator.GetAnnotationsWithTermInMetadata()).ToList()),
            };
            AnnotatedItemsBaseline.Add(current);
            writtenItemsStack.Push(current);

            foreach (var annotation in current.AnnotationsOnStart)
            {
                args.Entry.InstanceAnnotations.Add(annotation);
            }

            base.WriteStart(args);

            foreach (var annotation in current.AnnotationsOnEnd)
            {
                args.Entry.InstanceAnnotations.Add(annotation);
            }
        }
 /// <summary>
 /// Finish writing an entry.
 /// </summary>
 /// <param name="args">DataServiceODataWriterEntryArgs which contains the ODataEntry and the entry instance that is being serialized.</param>
 /// <remarks>
 /// This method calls WriteEnd() and it's used to track when WriteEnd is called for Entry.
 /// </remarks>
 public virtual void WriteEnd(DataServiceODataWriterEntryArgs args)
 {
     WebUtil.CheckArgumentNull(args, "args");
     this.WriteEnd();
 }
 /// <summary>
 /// Start writing an entry.
 /// </summary>
 /// <param name="args">DataServiceODataWriterEntryArgs which contains the ODataEntry and the entry instance to serialize.</param>
 public virtual void WriteStart(DataServiceODataWriterEntryArgs args)
 {
     WebUtil.CheckArgumentNull(args, "args");
     this.innerWriter.WriteStart(args.Entry);
 }
 /// <summary>
 /// Finish writing an entry.
 /// </summary>
 /// <param name="args">DataServiceODataWriterEntryArgs which contains the ODataEntry and the entry instance that is being serialized.</param>
 /// <remarks>
 /// This method calls WriteEnd() and it's used to track when WriteEnd is called for Entry.
 /// </remarks>
 public virtual void WriteEnd(DataServiceODataWriterEntryArgs args)
 {
     WebUtil.CheckArgumentNull(args, "args");
     this.WriteEnd();
 }
 /// <summary>
 /// Start writing an entry.
 /// </summary>
 /// <param name="args">DataServiceODataWriterEntryArgs which contains the ODataEntry and the entry instance to serialize.</param>
 public virtual void WriteStart(DataServiceODataWriterEntryArgs args)
 {
     WebUtil.CheckArgumentNull(args, "args");
     this.innerWriter.WriteStart(args.Entry);
 }
            public override void WriteEnd(DataServiceODataWriterEntryArgs args)
            {
                if (WriteEntryEnd.Value != null)
                {
                    if (WriteEntryEnd.Value(args)) return;
                }

                base.WriteEnd(args);
            }