2021-11-09 18:50:49 +08:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Yi.Framework.WebCore.BuilderExtend
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class JsonFileExtension
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void AddJsonFileService(this IConfigurationBuilder builder, params string[] JsonFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (JsonFile==null)
|
|
|
|
|
|
{
|
2022-04-24 17:09:43 +08:00
|
|
|
|
string[] myJsonFile = new string[] { "appsettings.json", "Config/configuration.json" };
|
2021-11-09 18:50:49 +08:00
|
|
|
|
foreach (var item in myJsonFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
builder.AddJsonFile(item, optional: true, reloadOnChange: false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in JsonFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
builder.AddJsonFile(item, optional: true, reloadOnChange: false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|