初始提交
This commit is contained in:
52
Services/Hncore.Pass.BaseInfo/Startup.cs
Normal file
52
Services/Hncore.Pass.BaseInfo/Startup.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Map;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Service;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
Configuration = env.UseAppsettings();
|
||||
}
|
||||
|
||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddDbContext<UserDbContext>(opt => { opt.UseMySql(Configuration["MySql"]); });
|
||||
|
||||
RedisHelper.Initialization(new CSRedis.CSRedisClient(Configuration["Redis"]));
|
||||
|
||||
services.AddHttpClient();
|
||||
|
||||
services.AddScoped<ManageService>();
|
||||
services.AddScoped<UserService>();
|
||||
services.AutoAddService();
|
||||
|
||||
return services.Init(Configuration, CompatibilityVersion.Version_2_2, new ServiceOption
|
||||
{
|
||||
UseGlobalManageAuthFilter = true,
|
||||
IgnoreJsonNullValue=true
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
app.Init(loggerFactory, applicationLifetime);
|
||||
MapConfig.Config();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user