NServiceBus.XmlSerializationExtensions.Namespace C# (CSharp) Method

Namespace() public static method

Configures the serializer to use a custom namespace. (http://tempuri.net) is the default.

If the provided namespace ends with trailing forward slashes, those will be removed on the fly.

public static Namespace ( this config, string namespaceToUse ) : SerializationExtensions
config this The to add a namespace to.
namespaceToUse string /// Namespace to use for interop scenarios. /// Note that this namespace is not validate or used for any logic inside NServiceBus. /// It is only for scenarios where a transport (or other infrastructure) requires message xml contents to have a specific /// namespace. ///
return SerializationExtensions
        public static SerializationExtensions<XmlSerializer> Namespace(this SerializationExtensions<XmlSerializer> config, string namespaceToUse)
        {
            Guard.AgainstNull(nameof(config), config);

            config.Settings.Set(XmlSerializer.CustomNamespaceConfigurationKey, namespaceToUse);

            return config;
        }