/*======================= PUBLIC ========================================*/
        /************************ Events *****************************************/
        /************************ Properties *************************************/
        /************************ Construction ***********************************/
        /*----------------------- WritableXmlConfigurationProvider --------------*/
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="source">
        /// XML configuraiton source
        /// </param>
        public WritableXmlConfigurationProvider(
            WritableXmlConfigurationSource source)
            : base(source)
        {
            Writer = source.Writer;

            FileStreamProvider = source.StreamProvider;

            return;
        } /* End of Function - WritableXmlConfigurationProvider */
예제 #2
0
        } /* End of Function - AddWritableXml */

        /*----------------------- AddWritableXml --------------------------------*/
        /// <summary>
        /// Adds a writable XML configuration source, using defaults.
        /// </summary>
        /// <param name="builder">Builder to add source to.</param>
        /// <param name="fileProvider">File provider to use.</param>
        /// <param name="path">Path of the XML file.</param>
        /// <param name="optional">Determines if loading the file is optional.</param>
        /// <param name="reloadOnChange">
        /// Determines if data should reload on file change.
        /// </param>
        /// <param name="writer">
        /// Service used to write the data to a stream.
        /// </param>
        /// <returns>
        /// The configuration builder.
        /// </returns>
        public static IConfigurationBuilder AddWritableXml(
            this IConfigurationBuilder builder,
            IFileProvider fileProvider,
            string path,
            bool optional,
            bool reloadOnChange,
            IFileStreamProvider fileStreamProvider,
            IXmlConfigurationWriter writer)
        {
            // Build our source
            var source = new WritableXmlConfigurationSource(writer, fileStreamProvider)
            {
                FileProvider   = fileProvider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            // Resolve the file provider
            source.ResolveFileProvider();

            // And finally add it back to the configuration builder.
            return(builder.Add(source));
        } /* End of Function - AddWritableXml */