提交版本
This commit is contained in:
parent
da6a965d26
commit
4ecc17510e
|
|
@ -0,0 +1,31 @@
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace HuanMeng.MiaoYu.Code.AppExtend
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dictionaryInfoServer"></param>
|
||||||
|
/// <param name="serviceProvider"></param>
|
||||||
|
public class AppConfigExtendServer(IDictionaryInfoServer dictionaryInfoServer, IServiceProvider serviceProvider) : IHostedService
|
||||||
|
{
|
||||||
|
public async Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
//var x = serviceProvider.CreateScope();
|
||||||
|
//注入数据字典
|
||||||
|
await dictionaryInfoServer.Initialization();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -100,6 +100,7 @@ namespace HuanMeng.MiaoYu.Code.AppExtend
|
||||||
ConfigurationManager = builder.Configuration;
|
ConfigurationManager = builder.Configuration;
|
||||||
AppConfigInit(builder.Configuration);
|
AppConfigInit(builder.Configuration);
|
||||||
builder.Services.AddScoped<AppConfig>();
|
builder.Services.AddScoped<AppConfig>();
|
||||||
|
builder.Services.AddHostedService<AppConfigExtendServer>();
|
||||||
return builder;
|
return builder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace HuanMeng.MiaoYu.Code.SysDictionary
|
||||||
builder.Services.AddSingleton<IDictionaryInfoServer, DictionaryInfoServerNetwork>();
|
builder.Services.AddSingleton<IDictionaryInfoServer, DictionaryInfoServerNetwork>();
|
||||||
|
|
||||||
builder.Services.AddScoped<IDictionaryInfo, DictionaryInfoNetwork>();
|
builder.Services.AddScoped<IDictionaryInfo, DictionaryInfoNetwork>();
|
||||||
builder.Services.AddHostedService<DictionaryInfoExtendServer>();
|
//builder.Services.AddHostedService<DictionaryInfoExtendServer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -62,21 +62,21 @@ namespace HuanMeng.MiaoYu.Code.SysDictionary
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
///
|
/////
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <param name="dictionaryInfoServer"></param>
|
///// <param name="dictionaryInfoServer"></param>
|
||||||
public class DictionaryInfoExtendServer(IDictionaryInfoServer dictionaryInfoServer) : IHostedService
|
//public class DictionaryInfoExtendServer(IDictionaryInfoServer dictionaryInfoServer) : IHostedService
|
||||||
{
|
//{
|
||||||
public async Task StartAsync(CancellationToken cancellationToken)
|
// public async Task StartAsync(CancellationToken cancellationToken)
|
||||||
{
|
// {
|
||||||
await dictionaryInfoServer.Initialization();
|
// await dictionaryInfoServer.Initialization();
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
public Task StopAsync(CancellationToken cancellationToken)
|
// public Task StopAsync(CancellationToken cancellationToken)
|
||||||
{
|
// {
|
||||||
return Task.CompletedTask;
|
// return Task.CompletedTask;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,16 +89,8 @@ builder.Services.AddControllers()
|
||||||
#endif
|
#endif
|
||||||
//options.SerializerSettings.Converters.Add()
|
//options.SerializerSettings.Converters.Add()
|
||||||
// 其他配置...
|
// 其他配置...
|
||||||
})
|
});
|
||||||
;
|
|
||||||
// .AddJsonOptions(options =>
|
|
||||||
//{
|
|
||||||
// //options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.Preserve;
|
|
||||||
// //options.JsonSerializerOptions.WriteIndented = true;
|
|
||||||
// options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
|
|
||||||
// //options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
|
||||||
// options.JsonSerializerOptions.Converters.Add(new CustomDateTimeConverter("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
//});
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(c =>
|
builder.Services.AddSwaggerGen(c =>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AgileConfig.Client" Version="1.7.3" />
|
||||||
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user