Esempio n. 1
0
        public static IConfigurationBuilder AddScriptFile(this IConfigurationBuilder builder, string path, bool optional = false, bool reloadOnChange = false)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("Missing file path!");
            }

            if (!Path.IsPathRooted(path))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
            }

            var source = new ScriptConfigurationSource
            {
                FileProvider   = new PhysicalFileProvider(Path.GetDirectoryName(path)),
                Path           = Path.GetFileName(path),
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            return(builder);
        }
 public ScriptConfigurationProvider(ScriptConfigurationSource source) : base(source)
 {
 }