示例#1
0
        public TomlConfigurationProvider(TomlConfigurationSource source)
            : base(source)
        {
            source.CheckNotNull(nameof(source));

            this.CaseInsensitiveKeys = source.CaseInsensitiveKeys;
        }
        public static IConfigurationBuilder AddTomlFile(this IConfigurationBuilder builder, IFileProvider provider, string path, Action <TomlConfigurationSource> configureSource)
        {
            var source = new TomlConfigurationSource()
            {
                FileProvider = provider,
                Path         = path
            };

            configureSource?.Invoke(source);

            source.ResolveFileProvider();

            return(builder.Add(source));
        }
        public static IConfigurationBuilder AddTomlFile(
            this IConfigurationBuilder builder,
            IFileProvider provider,
            string path,
            bool optional,
            bool reloadOnChange)
        {
            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }

            var source = new TomlConfigurationSource()
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange,
            };

            builder.Add(source);
            return(builder);
        }
示例#4
0
 public TomlConfigurationProvider(TomlConfigurationSource source)
     : base(source)
 {
     source.CheckNotNull(nameof(source));
 }