2021-10-13 15:40:56 +08:00
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
2022-04-09 16:16:32 +08:00
|
|
|
|
using Yi.Framework.Common.IOCOptions;
|
2021-10-13 15:40:56 +08:00
|
|
|
|
using Yi.Framework.Model;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Yi.Framework.WebCore.MiddlewareExtend
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通用跨域扩展
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static class IocExtension
|
|
|
|
|
|
{
|
|
|
|
|
|
public static IServiceCollection AddIocService(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
|
{
|
|
|
|
|
|
#region
|
|
|
|
|
|
//配置文件使用配置
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
services.AddSingleton(new Appsettings(configuration));
|
2022-04-02 17:44:50 +08:00
|
|
|
|
|
2022-04-09 16:16:32 +08:00
|
|
|
|
#region
|
|
|
|
|
|
//数据库连接字符串
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
services.Configure<SqlConnOptions>(Appsettings.appConfiguration("DbConn"));
|
|
|
|
|
|
|
2021-10-13 15:40:56 +08:00
|
|
|
|
return services;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|