2024-12-09 17:31:21 +08:00
|
|
|
|
using Abp.AspNetCore;
|
|
|
|
|
using Abp.AspNetCore.Configuration;
|
|
|
|
|
using Abp.Dependency;
|
2024-11-26 13:45:28 +08:00
|
|
|
|
using Abp.Modules;
|
2024-12-09 17:31:21 +08:00
|
|
|
|
using Abp.Reflection.Extensions;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2024-11-26 13:45:28 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2024-12-09 17:31:21 +08:00
|
|
|
|
using System.Diagnostics;
|
2024-11-26 13:45:28 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2024-12-10 10:26:25 +08:00
|
|
|
|
using YunDa.ISAS.Application.Core;
|
2024-12-09 17:31:21 +08:00
|
|
|
|
using YunDa.ISAS.Application.Core.Configuration;
|
|
|
|
|
using YunDa.ISAS.Configuration;
|
|
|
|
|
using YunDa.ISAS.Core;
|
2024-12-10 10:26:25 +08:00
|
|
|
|
using YunDa.ISAS.DataTransferObject;
|
|
|
|
|
using YunDa.ISAS.EntityFrameworkCore.EntityFrameworkCore;
|
|
|
|
|
using YunDa.ISAS.MongoDB;
|
2024-12-09 17:31:21 +08:00
|
|
|
|
using YunDa.ISAS.MongoDB.Configuration;
|
2024-12-10 10:26:25 +08:00
|
|
|
|
using YunDa.ISAS.Redis;
|
2024-12-09 17:31:21 +08:00
|
|
|
|
using YunDa.ISAS.Redis.Configuration;
|
2024-12-10 10:26:25 +08:00
|
|
|
|
using YunDa.ISMS.BASE.Entities;
|
2024-11-26 13:45:28 +08:00
|
|
|
|
|
|
|
|
|
namespace Yunda.SOMS.OperationsMainSiteGatewayServer
|
|
|
|
|
{
|
2024-12-09 17:31:21 +08:00
|
|
|
|
[DependsOn(
|
2024-12-10 10:26:25 +08:00
|
|
|
|
typeof(ISASCoreModule),
|
|
|
|
|
typeof(ISASEntityFrameworkCoreModule),
|
|
|
|
|
typeof(ISMS_BASEEntityFrameworkCoreModule),
|
|
|
|
|
typeof(ISASMongoDBModule),
|
|
|
|
|
typeof(ISASRedisModule)
|
|
|
|
|
)]
|
2024-11-26 13:45:28 +08:00
|
|
|
|
public class OperationsGatewayAppModule : AbpModule
|
|
|
|
|
{
|
2024-12-10 10:26:25 +08:00
|
|
|
|
public OperationsGatewayAppModule(ISASEntityFrameworkCoreModule isasEntityFrameworkModule)
|
2024-11-26 13:45:28 +08:00
|
|
|
|
{
|
2024-12-10 10:26:25 +08:00
|
|
|
|
isasEntityFrameworkModule.SkipDbSeed = true;
|
2024-11-26 13:45:28 +08:00
|
|
|
|
|
|
|
|
|
}
|
2024-12-10 10:26:25 +08:00
|
|
|
|
public override void PreInitialize()
|
2024-11-26 13:45:28 +08:00
|
|
|
|
{
|
2024-12-10 10:26:25 +08:00
|
|
|
|
// 预初始化阶段,可以进行一些配置
|
|
|
|
|
Console.WriteLine("PreInitialize: ABP Module Setup");
|
2024-12-09 17:31:21 +08:00
|
|
|
|
var _appConfiguration = new ConfigurationBuilder()
|
|
|
|
|
.AddJsonFile("appsettings.json")
|
|
|
|
|
.Build();
|
|
|
|
|
// 后初始化阶段
|
|
|
|
|
Console.WriteLine("PostInitialize: ABP Module Post Initialization");
|
|
|
|
|
Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(
|
|
|
|
|
ISASConsts.ConnectionMysqlStringKey
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 输出时间格式
|
|
|
|
|
Debug.WriteLine("MySql数据库连接:" + _appConfiguration.GetConnectionString(ISASConsts.ConnectionMysqlStringKey));
|
|
|
|
|
|
|
|
|
|
#region 设置MogngoDBConfig
|
|
|
|
|
|
|
|
|
|
var mongoConfiguration = Configuration.Modules.ISASConfiguration<IMongoDBConfiguration>();
|
|
|
|
|
ConfigurationHelper.SetMongoDBConfiguration(_appConfiguration, ref mongoConfiguration);
|
|
|
|
|
Console.WriteLine("MongoDB数据库连接:" + mongoConfiguration.HostString + ":" + mongoConfiguration.Port);
|
|
|
|
|
|
|
|
|
|
#endregion 设置MogngoDBConfig
|
|
|
|
|
|
|
|
|
|
#region 设置redisconfig
|
|
|
|
|
var redisConfiguration = Configuration.Modules.ISASConfiguration<IRedisConfiguration>();
|
|
|
|
|
ConfigurationHelper.SetRedisConfiguration(_appConfiguration, ref redisConfiguration);
|
|
|
|
|
Console.WriteLine("Redis数据库连接:" + redisConfiguration.Host + ":" + redisConfiguration.Port);
|
|
|
|
|
#endregion
|
|
|
|
|
|
2024-12-10 10:26:25 +08:00
|
|
|
|
|
|
|
|
|
}
|
2024-12-09 17:31:21 +08:00
|
|
|
|
|
2024-12-10 10:26:25 +08:00
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
// 初始化阶段
|
|
|
|
|
IocManager.RegisterAssemblyByConvention(typeof(OperationsGatewayAppModule).GetAssembly());
|
|
|
|
|
Console.WriteLine("Initialize: ABP Module Initialized");
|
|
|
|
|
//ServiceCollectionRegistrar.Register(IocManager);
|
|
|
|
|
}
|
2024-12-09 17:31:21 +08:00
|
|
|
|
|
2024-12-10 10:26:25 +08:00
|
|
|
|
public override void PostInitialize()
|
|
|
|
|
{
|
|
|
|
|
|
2024-12-09 17:31:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
// 关闭时调用
|
|
|
|
|
Console.WriteLine("Shutdown: ABP Module Shut down");
|
2024-11-26 13:45:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|