48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Castle.MicroKernel.Registration;
|
|
using Abp.Events.Bus;
|
|
using Abp.Modules;
|
|
using Abp.Reflection.Extensions;
|
|
using BCS.BMC.Configuration;
|
|
using BCS.BMC.EntityFrameworkCore;
|
|
using BCS.BMC.Migrator.DependencyInjection;
|
|
|
|
namespace BCS.BMC.Migrator
|
|
{
|
|
[DependsOn(typeof(BMCEntityFrameworkModule))]
|
|
public class BMCMigratorModule : AbpModule
|
|
{
|
|
private readonly IConfigurationRoot _appConfiguration;
|
|
|
|
public BMCMigratorModule(BMCEntityFrameworkModule abpProjectNameEntityFrameworkModule)
|
|
{
|
|
abpProjectNameEntityFrameworkModule.SkipDbSeed = true;
|
|
|
|
_appConfiguration = AppConfigurations.Get(
|
|
typeof(BMCMigratorModule).GetAssembly().GetDirectoryPathOrNull()
|
|
);
|
|
}
|
|
|
|
public override void PreInitialize()
|
|
{
|
|
Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(
|
|
BMCConsts.ConnectionStringName
|
|
);
|
|
|
|
Configuration.BackgroundJobs.IsJobExecutionEnabled = false;
|
|
Configuration.ReplaceService(
|
|
typeof(IEventBus),
|
|
() => IocManager.IocContainer.Register(
|
|
Component.For<IEventBus>().Instance(NullEventBus.Instance)
|
|
)
|
|
);
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
IocManager.RegisterAssemblyByConvention(typeof(BMCMigratorModule).GetAssembly());
|
|
ServiceCollectionRegistrar.Register(IocManager);
|
|
}
|
|
}
|
|
}
|