public static void Settings(this SerializationExtensions <When_registering_additional_deserializers.MyCustomSerializer> extensions, When_registering_additional_deserializers.Context context, string valueFromSettings) { var settings = extensions.GetSettings(); settings.Set("MyCustomSerializer.Settings", context); settings.Set("MyCustomSerializer.Settings.Value", valueFromSettings); }
/// <summary> /// Configures the <see cref="SerializationContext"/> to use. /// </summary> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="context">The <see cref="SerializationContext"/> to use.</param> public static void Context(this SerializationExtensions <MessagePack.MessagePackSerializer> config, SerializationContext context) { Guard.AgainstNull(config, nameof(config)); var settings = config.GetSettings(); settings.Set <SerializationContext>(context); }
/// <summary> /// Configures string to use for <see cref="Headers.ContentType"/> headers. /// </summary> /// <remarks> /// Defaults to "bond". /// </remarks> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="contentTypeKey">The content type key to use.</param> public static void ContentTypeKey(this SerializationExtensions <BondSerializer> config, string contentTypeKey) { Guard.AgainstEmpty(contentTypeKey, nameof(contentTypeKey)); var settings = config.GetSettings(); settings.Set("NServiceBus.Bond.ContentTypeKey", contentTypeKey); }
/// <summary> /// Configures the <see cref="SerializerOptions"/> to use. /// </summary> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="options">The <see cref="SerializerOptions"/> to use.</param> public static void Options(this SerializationExtensions <WireSerializer> config, SerializerOptions options) { Guard.AgainstNull(config, nameof(config)); var settings = config.GetSettings(); settings.Set(options); }
/// <summary> /// Configures string to use for <see cref="Headers.ContentType"/> headers. /// </summary> /// <remarks> /// Defaults to "wire". /// </remarks> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="contentTypeKey">The content type key to use.</param> public static void ContentTypeKey(this SerializationExtensions <MessagePack.MessagePackSerializer> config, string contentTypeKey) { Guard.AgainstNull(config, nameof(config)); Guard.AgainstNullOrEmpty(contentTypeKey, nameof(contentTypeKey)); var settings = config.GetSettings(); settings.Set("NServiceBus.MessagePack.ContentTypeKey", contentTypeKey); }
public static SerializationExtensions <When_registering_deserializers_with_settings.MyCustomSerializer> Settings(this SerializationExtensions <When_registering_deserializers_with_settings.MyCustomSerializer> extensions, string valueFromSettings, When_registering_deserializers_with_settings.Context context) { var settings = extensions.GetSettings(); settings.Set("MyCustomSerializer.Settings", valueFromSettings); settings.Set <When_registering_deserializers_with_settings.Context>(context); return(extensions); }
/// <summary> /// Configures the <see cref="JsonWriterOptions"/> to use. /// </summary> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="options">The <see cref="JsonWriterOptions"/> to use.</param> public static void WriterOptions(this SerializationExtensions <SystemJsonSerializer> config, JsonWriterOptions options) { Guard.AgainstNull(config, nameof(config)); Guard.AgainstNull(options, nameof(options)); var settings = config.GetSettings(); settings.Set(options); }
public static void Settings(this SerializationExtensions <MyCustomSerializerDefinition> config, string value) { var settingsHolder = config.GetSettings(); settingsHolder.Set(MyCustomSerializerDefinition.Key, value); }
/// <summary> /// Sets a the convention to use for serializing and deserializing messages. /// For serialization: default constructors of <see cref="CompactBinaryWriter{I}"/> and <see cref="Serializer{W}"/> /// For deserialization: default constructors of <see cref="CompactBinaryReader{I}"/> and <see cref="Deserializer{W}"/> /// </summary> public static void SerializationDelegates(this SerializationExtensions <BondSerializer> config, Func <Type, SerializationDelegates> serializationDelegatesBuilder) { var settings = config.GetSettings(); settings.Set(serializationDelegatesBuilder); }
/// <summary> /// Configures string to use for <see cref="Headers.ContentType"/> headers. /// </summary> /// <remarks> /// Defaults to <see cref="ContentTypes.Json"/>. /// This setting is required when this serializer needs to co-exist with other json serializers. /// </remarks> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="contentTypeKey">The content type key to use.</param> public static void ContentTypeKey(this SerializationExtensions <NewtonsoftSerializer> config, string contentTypeKey) { Guard.AgainstNull(config, nameof(config)); Guard.AgainstNullOrEmpty(contentTypeKey, nameof(contentTypeKey)); config.GetSettings().Set("NServiceBus.Newtonsoft.Json.ContentTypeKey", contentTypeKey); }
/// <summary> /// Configures the <see cref="JsonSerializerSettings"/> to use. /// </summary> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="settings">The <see cref="JsonSerializerSettings"/> to use.</param> public static void Settings(this SerializationExtensions <NewtonsoftSerializer> config, JsonSerializerSettings settings) { Guard.AgainstNull(config, nameof(config)); Guard.AgainstNull(settings, nameof(settings)); config.GetSettings().Set("NServiceBus.Newtonsoft.Json.Settings", settings); }
/// <summary> /// Configures the <see cref="JsonWriter"/> creator of JSON stream. /// </summary> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="writerCreator">A delegate that creates a <see cref="JsonWriter"/> for a <see cref="Stream"/>.</param> public static void WriterCreator(this SerializationExtensions <NewtonsoftSerializer> config, Func <Stream, JsonWriter> writerCreator) { Guard.AgainstNull(config, nameof(config)); Guard.AgainstNull(writerCreator, nameof(writerCreator)); config.GetSettings().Set("NServiceBus.Newtonsoft.Json.WriterCreator", writerCreator); }
/// <summary> /// Configures the <see cref="TextReader"/> creator of JSON stream. /// </summary> /// <param name="config">The <see cref="SerializationExtensions{T}"/> instance.</param> /// <param name="readerCreator">A delegate that creates a <see cref="TextReader"/> for a <see cref="Stream"/>.</param> public static void ReaderCreator(this SerializationExtensions <JilSerializer> config, Func <Stream, TextReader> readerCreator) { Guard.AgainstNull(config, nameof(config)); Guard.AgainstNull(readerCreator, nameof(readerCreator)); config.GetSettings().Set("NServiceBus.Jil.ReaderCreator", readerCreator); }