You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.2 KiB
C#

using Autofac;
using Autofac.Extensions.DependencyInjection;
using DS.Module.Core.Extensions;
using DS.Module.MultiLanguage;
using DS.Module.SqlSugar;
using DS.Module.Swagger;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using NLog.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.Middleware.ServiceExtensions
{
public static class PublicServiceExtensions
{
public static WebApplicationBuilder AddPublicService(this WebApplicationBuilder builder)
{
var environment = builder.Environment.EnvironmentName;
Console.WriteLine("当前开发环境:" + environment);
//注册配置
builder.Configuration
// .SetBasePath(builder.Environment.ContentRootPath)
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
// .AddJsonFile(path: $"appsettings.{environment}.json", optional: true, reloadOnChange: true)
.Build();
builder.Configuration.AddEnvironmentVariables();
builder.Logging.AddNLog("nlog.config");
// Add services to the container.
////Autofac注入
//builder.Host
// .UseServiceProviderFactory(new AutofacServiceProviderFactory())
// .ConfigureContainer<ContainerBuilder>(builder => { builder.RegisterModule(new AutofacModuleRegister()); });
//builder.Services.AddAppWebInstal();
//builder.Services.AddCorsInstall();
//builder.Services.AddUserModuleInstall(); //用户服务
//builder.Services.AddSqlSugarInstall();
//builder.Services.AddSwaggerInstall();
//builder.Services.AddJwtInstall();
builder.Services.AddSaasDbInstall();//分库服务
builder.Services.AddMultiLanguageInstall();//多语言服务
// builder.Services.AddEndpointsApiExplorer();
// builder.Services.AddSwaggerGen();
return builder;
}
}
}