/// <summary>
 /// Initializes a new instance of the <see cref="VolatileProcessingPipelineStageSetting{T}"/> class
 /// without a default value.
 /// </summary>
 /// <param name="configuration">The configuration the setting belongs to.</param>
 /// <param name="name">Name of the setting.</param>
 /// <param name="valueToStringConverter">Delegate that converts a string to the setting value.</param>
 /// <param name="stringToValueConverter">Delegate that converts the setting value to a string.</param>
 internal VolatileProcessingPipelineStageSetting(
     VolatileProcessingPipelineStageConfiguration configuration,
     string name,
     ObjectToStringConversionDelegate <T> valueToStringConverter,
     StringToObjectConversionDelegate <T> stringToValueConverter)
 {
     mConfiguration          = configuration;
     mValueToStringConverter = valueToStringConverter;
     mStringToValueConverter = stringToValueConverter;
     Name                  = name;
     mDefaultValue         = mValue = default;
     mDefaultValueAsString = mValueAsString = null;
     mHasValue             = false;
     mHasDefaultValue      = false;
 }
Example #2
0
        /// <summary>
        /// Adds a configuration for a pipeline stage with the specified name.
        /// </summary>
        /// <param name="name">Name of the pipeline stage.</param>
        /// <returns>Configuration for the pipeline stage with the specified name.</returns>
        public IProcessingPipelineStageConfiguration AddNew(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            lock (mLogConfiguration.Sync)
            {
                var stage = mStageConfigurations.FirstOrDefault(x => x.Name == name);
                if (stage != null)
                {
                    throw new ArgumentException($"The collection already contains a configuration for the pipeline stage with the specified name ({name}).", nameof(name));
                }
                stage = new VolatileProcessingPipelineStageConfiguration(name, mLogConfiguration);
                mStageConfigurations.Add(stage);
                mLogConfiguration.OnChanged();
                return(stage);
            }
        }