爆肝,重构框架,你懂得

This commit is contained in:
chenchun
2023-01-01 23:06:11 +08:00
parent dbe020dc94
commit b9384afd5d
276 changed files with 5205 additions and 3281 deletions

View File

@@ -7,6 +7,7 @@ using Com.Ctrip.Framework.Apollo.Enums;
using Com.Ctrip.Framework.Apollo.Logging;
using Microsoft.Extensions.Primitives;
using System.Reflection;
using Yi.Framework.WebCore.CommonExtend;
namespace Yi.Framework.WebCore.BuilderExtend
{

View File

@@ -3,31 +3,30 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Configuration;
using Yi.Framework.WebCore.BuilderExtend.OptionsWritable;
using Yi.Framework.WebCore.BuilderExtend.OptionsWritable.Internal;
namespace Yi.Framework.WebCore.BuilderExtend;
namespace Yi.Framework.WebCore.BuilderExtend.OptionsWritable;
public static class OptionsWritableConfigurationServiceCollectionExtensions
{
public static void ConfigureJson<TOption>(this IServiceCollection services, Microsoft.Extensions.Configuration.ConfigurationManager configuration, string jsonFilePath)
public static void ConfigureJson<TOption>(this IServiceCollection services, Microsoft.Extensions.Configuration.ConfigurationManager configuration, string jsonFilePath)
where TOption : class, new()
{
ConfigureJson<TOption>(services, configuration.GetSection(typeof(TOption).Name), jsonFilePath);
services.ConfigureJson<TOption>(configuration.GetSection(typeof(TOption).Name), jsonFilePath);
}
public static void ConfigureJson<TOption>(this IServiceCollection services, IConfigurationSection section, string jsonFilePath)
public static void ConfigureJson<TOption>(this IServiceCollection services, IConfigurationSection section, string jsonFilePath)
where TOption : class, new()
{
services.Configure<TOption>(section);
services.AddTransient<IOptionsWritable<TOption>>(provider =>
services.AddTransient<IOptionsWritable<TOption>>(provider =>
new JsonOptionsWritable<TOption>(provider.GetRequiredService<IOptionsMonitor<TOption>>(), section.Key, jsonFilePath));
}
public static void ConfigureJson<TOption>(this IServiceCollection services, Microsoft.Extensions.Configuration.ConfigurationManager configuration, Func<IServiceProvider, string> jsonFilePathFunc)
where TOption : class, new()
{
ConfigureJson<TOption>(services, configuration.GetSection(typeof(TOption).Name), jsonFilePathFunc);
services.ConfigureJson<TOption>(configuration.GetSection(typeof(TOption).Name), jsonFilePathFunc);
}
public static void ConfigureJson<TOption>(this IServiceCollection services, IConfigurationSection section, Func<IServiceProvider, string> jsonFilePathFunc)