Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileBackedProcessingPipelineStageRawSetting"/> class
 /// without a default value.
 /// </summary>
 /// <param name="configuration">The configuration the setting belongs to.</param>
 /// <param name="name">Name of the setting.</param>
 internal FileBackedProcessingPipelineStageRawSetting(
     FileBackedProcessingPipelineStageConfiguration configuration,
     string name)
 {
     StageConfiguration = configuration;
     Name             = name;
     mHasDefaultValue = false;
     mDefaultValue    = null;
 }
        /// <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 FileBackedProcessingPipelineStageConfiguration(mLogConfiguration, name);
                mStageConfigurations.Add(stage);
                mLogConfiguration.OnChanged();
                return(stage);
            }
        }