// response serializers /// <summary>Sets fallback response serializer in Message Response Provider.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="serializer">Response serializer to fall back to.</param> /// <seealso cref="ResponseSerializerProvider"/> /// <seealso cref="ISerializerProvider{TKey, TSerializer}"/> /// <seealso cref="IResponseSerializer"/> /// <seealso cref="ResponseSerializerProviderOptions.FallbackSerializer"/> public static IHostedWolfClientServiceBuilder SetFallbackResponseSerializer(this IHostedWolfClientServiceBuilder builder, IResponseSerializer serializer) { if (serializer == null) { throw new ArgumentNullException(nameof(serializer)); } return(builder.ConfigureResponseSerializerProvider(options => options.FallbackSerializer = serializer)); }
/// <summary>Maps a response serializer in Message Response Provider.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="responseType">Type of response message.</param> /// <param name="serializer">Serializer to serialize and deserialize with.</param> /// <seealso cref="ResponseSerializerProvider"/> /// <seealso cref="ISerializerProvider{TKey, TSerializer}"/> /// <seealso cref="IResponseSerializer"/> /// <seealso cref="ResponseSerializerProviderOptions.Serializers"/> public static IHostedWolfClientServiceBuilder MapResponseSerializer(this IHostedWolfClientServiceBuilder builder, Type responseType, IResponseSerializer serializer) => builder.ConfigureResponseSerializerProvider(options => options.Serializers[responseType] = serializer);