/// <summary> /// Writes the entity result to the response message. /// </summary> /// <param name="graph">The entity result to write.</param> /// <param name="type">The type of the entity.</param> /// <param name="messageWriter">The message writer.</param> /// <param name="writeContext">The writing context.</param> public override void WriteObject( object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext) { RawResult rawResult = graph as RawResult; if (rawResult != null) { graph = rawResult.Result; type = rawResult.Type; } if (writeContext != null) { graph = RestierPrimitiveSerializer.ConvertToPayloadValue(graph, writeContext); } if (graph == null) { // This is to make ODataRawValueSerializer happily serialize null value. graph = string.Empty; } base.WriteObject(graph, type, messageWriter, writeContext); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRestierSerializerProvider" /> class. /// </summary> /// <param name="rootContainer">The container to get the service</param> public DefaultRestierSerializerProvider(IServiceProvider rootContainer) : base(rootContainer) { this.resourceSetSerializer = new RestierResourceSetSerializer(this); this.primitiveSerializer = new RestierPrimitiveSerializer(); this.rawSerializer = new RestierRawSerializer(); this.resourceSerializer = new RestierResourceSerializer(this); this.collectionSerializer = new RestierCollectionSerializer(this); this.enumSerializer = new RestierEnumSerializer(this); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRestierSerializerProvider" /> class. /// </summary> public CustomizedSerializerProvider(IServiceProvider serviceProvider) : base(serviceProvider) { this.primitiveSerializer = new CustomizedPrimitiveSerializer(); }