|
|
@ -3,6 +3,7 @@ using Autofac;
|
|
|
|
using Autofac.Extensions.DependencyInjection;
|
|
|
|
using Autofac.Extensions.DependencyInjection;
|
|
|
|
using Entity.Dto.Resp;
|
|
|
|
using Entity.Dto.Resp;
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.AutoTask;
|
|
|
|
using HybirdFrameworkCore.Configuration;
|
|
|
|
using HybirdFrameworkCore.Configuration;
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using HybirdFrameworkCore.Redis;
|
|
|
|
using HybirdFrameworkCore.Redis;
|
|
|
@ -31,9 +32,9 @@ builder.Host.ConfigureContainer<ContainerBuilder>(cb =>
|
|
|
|
ConnectionString = AppSettingsConstVars.DbSqlConnection, // 设置数据库连接字符串
|
|
|
|
ConnectionString = AppSettingsConstVars.DbSqlConnection, // 设置数据库连接字符串
|
|
|
|
DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? DbType.MySql : DbType.SqlServer,
|
|
|
|
DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? DbType.MySql : DbType.SqlServer,
|
|
|
|
IsAutoCloseConnection = true,
|
|
|
|
IsAutoCloseConnection = true,
|
|
|
|
|
|
|
|
|
|
|
|
InitKeyType = InitKeyType.Attribute // 如果使用实体类的属性进行主键标识,请设置为 InitKeyType.Attr
|
|
|
|
InitKeyType = InitKeyType.Attribute // 如果使用实体类的属性进行主键标识,请设置为 InitKeyType.Attr
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return db;
|
|
|
|
return db;
|
|
|
|
}).As<ISqlSugarClient>().SingleInstance();
|
|
|
|
}).As<ISqlSugarClient>().SingleInstance();
|
|
|
@ -42,7 +43,7 @@ builder.Host.ConfigureContainer<ContainerBuilder>(cb =>
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 注册自定义映射
|
|
|
|
// 注册自定义映射
|
|
|
|
var mapper = new SysMenuMapper();
|
|
|
|
var mapper = new SysMenuMapper();
|
|
|
|
mapper.Register(TypeAdapterConfig.GlobalSettings);
|
|
|
|
mapper.Register(TypeAdapterConfig.GlobalSettings);
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +67,7 @@ builder.Services.AddCors(options =>
|
|
|
|
|
|
|
|
|
|
|
|
//redis
|
|
|
|
//redis
|
|
|
|
var redisConnectionString = AppSettingsHelper.GetContent("Redis", "Connection");
|
|
|
|
var redisConnectionString = AppSettingsHelper.GetContent("Redis", "Connection");
|
|
|
|
var instanceName = AppSettingsHelper.GetContent("Redis", "InstanceName");//默认数据库
|
|
|
|
var instanceName = AppSettingsHelper.GetContent("Redis", "InstanceName");//默认数据库
|
|
|
|
var defaultDb = int.Parse(AppSettingsHelper.GetContent("Redis", "DefaultDB") ?? "0");
|
|
|
|
var defaultDb = int.Parse(AppSettingsHelper.GetContent("Redis", "DefaultDB") ?? "0");
|
|
|
|
if (redisConnectionString != null && instanceName != null)
|
|
|
|
if (redisConnectionString != null && instanceName != null)
|
|
|
|
builder.Services.AddSingleton(new RedisHelper(redisConnectionString, instanceName, defaultDb));
|
|
|
|
builder.Services.AddSingleton(new RedisHelper(redisConnectionString, instanceName, defaultDb));
|
|
|
@ -88,8 +89,8 @@ builder.Services.AddSwaggerGen(c =>
|
|
|
|
c.IncludeXmlComments(Path.Combine(basePath, "WebStarter.xml"), true);
|
|
|
|
c.IncludeXmlComments(Path.Combine(basePath, "WebStarter.xml"), true);
|
|
|
|
c.IncludeXmlComments(Path.Combine(basePath, "Entity.xml"), true);
|
|
|
|
c.IncludeXmlComments(Path.Combine(basePath, "Entity.xml"), true);
|
|
|
|
c.IncludeXmlComments(Path.Combine(basePath, "HybirdFrameworkCore.xml"), true);
|
|
|
|
c.IncludeXmlComments(Path.Combine(basePath, "HybirdFrameworkCore.xml"), true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
builder.Services.AddControllers().AddJsonOptions(configure =>
|
|
|
|
builder.Services.AddControllers().AddJsonOptions(configure =>
|
|
|
@ -168,5 +169,7 @@ if (AppSettingsHelper.GetBool("task", "enable"))
|
|
|
|
StationSoftMgr.StartTasks();
|
|
|
|
StationSoftMgr.StartTasks();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TaskInit.Init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.Run();
|
|
|
|
app.Run();
|
|
|
|