|
|
|
|
using Admin.Core.Common;
|
|
|
|
|
using Admin.Core.Extensions;
|
|
|
|
|
using Admin.Core.IRepository;
|
|
|
|
|
using Admin.Core.IService;
|
|
|
|
|
using Admin.Core.IService.ISys;
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using Admin.Core.Repository;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
using Admin.Core.Tasks;
|
|
|
|
|
using Autofac;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using TouchSocket.Http;
|
|
|
|
|
using Admin.Core.Socket;
|
|
|
|
|
|
|
|
|
|
namespace Admin.Core.RealTimeService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Startup
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Startup
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Startup
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="configuration"></param>
|
|
|
|
|
/// <param name="env"></param>
|
|
|
|
|
public Startup(IConfiguration configuration, IWebHostEnvironment env)
|
|
|
|
|
{
|
|
|
|
|
Configuration = configuration;
|
|
|
|
|
Env = env;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// IConfiguration
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IWebHostEnvironment Env { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This method gets called by the runtime. Use this method to add services to the container.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="services"></param>
|
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
//Appsettings
|
|
|
|
|
services.AddSingleton(new Appsettings(Configuration));
|
|
|
|
|
//<2F><>־<EFBFBD>ļ<EFBFBD>Ŀ¼
|
|
|
|
|
services.AddSingleton(new LogLock(Env.ContentRootPath));
|
|
|
|
|
//Memory<72><79><EFBFBD><EFBFBD>
|
|
|
|
|
services.AddMemoryCacheSetup();
|
|
|
|
|
//Sqlsugar<61><72><EFBFBD>ݿ<EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD>ѯ
|
|
|
|
|
services.AddSqlsugarSetup();
|
|
|
|
|
//AutoMapper
|
|
|
|
|
services.AddAutoMapperSetup();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>TouchSocket
|
|
|
|
|
//services.AddTouchSocketSetup();
|
|
|
|
|
//ע<><D7A2>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
AddServices(services);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
services.AddJobSetup();
|
|
|
|
|
|
|
|
|
|
//֧<>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>ȫ <20><><EFBFBD><EFBFBD>:֧<><D6A7> System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030")
|
|
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ע<><D7A2><EFBFBD><EFBFBD>Program.CreateHostBuilder<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Autofac<61><63><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="builder"></param>
|
|
|
|
|
public void ConfigureContainer(ContainerBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
builder.RegisterModule(new AutofacModuleRegister());
|
|
|
|
|
builder.RegisterModule<AutofacPropertityModuleReg>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <param name="env"></param>
|
|
|
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISysTasksQzService tasksQzService, ISchedulerCenter schedulerCenter)
|
|
|
|
|
{
|
|
|
|
|
// ʹ<>þ<EFBFBD>̬<EFBFBD>ļ<EFBFBD>
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
// Ȼ<><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
|
|
|
|
//app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>QuartzNetJob<6F><62><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>
|
|
|
|
|
app.UseQuartzJobMildd(tasksQzService, schedulerCenter);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>TouchSocket
|
|
|
|
|
//app.UseTouchSocketMildd(touchSocketService,httpService);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="services"></param>
|
|
|
|
|
private static void AddServices(IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
#region ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//services.AddScoped<IEEquipmentCategoryServices, EEquipmentCategoryServices>();
|
|
|
|
|
//services.AddScoped<IEEquipmentCategoryRepository, EEquipmentCategoryRepository>();
|
|
|
|
|
//services.AddScoped<IBaseRepository<EEquipmentCategory>, BaseRepository<EEquipmentCategory>>();
|
|
|
|
|
//services.AddSingleton<IBaseServices<EEquipmentCategory>, BaseServices<EEquipmentCategory>>();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|