Ejemplo n.º 1
0
 /// <summary>
 /// Constructs a <see cref="JsonLightInstanceAnnotationWriter"/> that can write a collection of <see cref="ODataInstanceAnnotation"/>.
 /// </summary>
 /// <param name="valueSerializer">The <see cref="IODataJsonLightValueSerializer"/> to use for writing values of instance annotations.
 /// The <see cref="IJsonWriter"/> that is also used internally will be acquired from the this instance.</param>
 /// <param name="typeNameOracle">The oracle to use to determine the type name to write for entries and values.</param>
 internal JsonLightInstanceAnnotationWriter(IODataJsonLightValueSerializer valueSerializer, JsonLightTypeNameOracle typeNameOracle)
 {
     Debug.Assert(valueSerializer != null, "valueSerializer should not be null");
     this.valueSerializer       = valueSerializer;
     this.typeNameOracle        = typeNameOracle;
     this.jsonWriter            = this.valueSerializer.JsonWriter;
     this.odataAnnotationWriter = new JsonLightODataAnnotationWriter(this.jsonWriter, valueSerializer.Settings.ODataSimplified);
 }
 public JsonLightODataAnnotationWriterTests()
 {
     this.builder                    = new StringBuilder();
     this.stringWriter               = new StringWriter(builder);
     this.asyncJsonWriter            = (IJsonWriterAsync) new JsonWriter(this.stringWriter, isIeee754Compatible: true);
     this.asyncODataAnnotationWriter = new JsonLightODataAnnotationWriter(
         this.asyncJsonWriter, false, ODataVersion.V4);
 }
 /// <summary>
 /// Constructs a <see cref="JsonLightInstanceAnnotationWriter"/> that can write a collection of <see cref="ODataInstanceAnnotation"/>.
 /// </summary>
 /// <param name="valueSerializer">The <see cref="ODataJsonLightValueSerializer"/> to use for writing values of instance annotations.
 /// The <see cref="IJsonWriter"/> that is also used internally will be acquired from the this instance.</param>
 /// <param name="typeNameOracle">The oracle to use to determine the type name to write for entries and values.</param>
 internal JsonLightInstanceAnnotationWriter(ODataJsonLightValueSerializer valueSerializer, JsonLightTypeNameOracle typeNameOracle)
 {
     Debug.Assert(valueSerializer != null, "valueSerializer should not be null");
     this.valueSerializer       = valueSerializer;
     this.typeNameOracle        = typeNameOracle;
     this.jsonWriter            = this.valueSerializer.JsonWriter;
     this.odataAnnotationWriter = new JsonLightODataAnnotationWriter(this.jsonWriter,
                                                                     valueSerializer.JsonLightOutputContext.ODataSimplifiedOptions.EnableWritingODataAnnotationWithoutPrefix, this.valueSerializer.MessageWriterSettings.Version);
     this.writerValidator = this.valueSerializer.MessageWriterSettings.Validator;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructs a <see cref="JsonLightInstanceAnnotationWriter"/> that can write a collection of <see cref="ODataInstanceAnnotation"/>.
 /// </summary>
 /// <param name="valueSerializer">The <see cref="ODataJsonLightValueSerializer"/> to use for writing values of instance annotations.
 /// The <see cref="IJsonWriter"/> that is also used internally will be acquired from the this instance.</param>
 /// <param name="typeNameOracle">The oracle to use to determine the type name to write for entries and values.</param>
 internal JsonLightInstanceAnnotationWriter(ODataJsonLightValueSerializer valueSerializer, JsonLightTypeNameOracle typeNameOracle)
 {
     Debug.Assert(valueSerializer != null, "valueSerializer should not be null");
     this.valueSerializer                   = valueSerializer;
     this.typeNameOracle                    = typeNameOracle;
     this.jsonWriter                        = this.valueSerializer.JsonWriter;
     this.odataAnnotationWriter             = this.valueSerializer.ODataAnnotationWriter;
     this.asynchronousJsonWriter            = this.valueSerializer.AsynchronousJsonWriter;
     this.asynchronousODataAnnotationWriter = this.valueSerializer.AsynchronousODataAnnotationWriter;
     this.writerValidator                   = this.valueSerializer.MessageWriterSettings.Validator;
 }