2023-04-12 22:52:09 +08:00
|
|
|
|
using Furion;
|
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2023-04-15 22:44:33 +08:00
|
|
|
|
using StackExchange.Profiling.SqlFormatters;
|
2023-04-12 22:52:09 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.AspNetCore;
|
2023-04-18 20:29:53 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.Auth;
|
2023-04-16 14:30:56 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.Data;
|
2023-04-15 22:44:33 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.Data.Filters;
|
2023-04-12 22:52:09 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.Sqlsugar;
|
2023-04-15 22:44:33 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.Sqlsugar.Filters;
|
2023-04-15 12:25:47 +08:00
|
|
|
|
using Yi.Framework.Infrastructure.Sqlsugar.Uow;
|
2023-04-12 22:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
namespace Yi.Framework.Infrastructure;
|
|
|
|
|
|
|
|
|
|
|
|
public class Startup : AppStartup
|
|
|
|
|
|
{
|
|
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
|
|
|
|
{
|
|
|
|
|
|
services.AddCurrentUserServer();
|
|
|
|
|
|
|
|
|
|
|
|
services.Configure<DbConnOptions>(App.Configuration.GetSection("DbConnOptions"));
|
|
|
|
|
|
|
|
|
|
|
|
services.AddDbSqlsugarContextServer();
|
2023-04-15 12:25:47 +08:00
|
|
|
|
|
|
|
|
|
|
services.AddUnitOfWork<SqlsugarUnitOfWork>();
|
2023-04-15 22:44:33 +08:00
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IDataFilter, SqlsugarDataFilter>();
|
2023-04-18 20:29:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services.AddSingleton<IPermissionHandler, DefaultPermissionHandler>();
|
|
|
|
|
|
services.AddSingleton<PermissionGlobalAttribute>();
|
|
|
|
|
|
services.AddControllers(options => {
|
|
|
|
|
|
options.Filters.Add<PermissionGlobalAttribute>();
|
|
|
|
|
|
});
|
2023-04-12 22:52:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
|
|
|
|
{
|
2023-04-16 14:30:56 +08:00
|
|
|
|
app.UseDataFiterServer();
|
2023-04-12 22:52:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|