Openly I think it is not an issue but caused from the --watch parameter in package.json which keeps webpack running.
Dear Maliming
Many thanks for your feedback and for the link. You are right, investigating from the link I could trace down the issue. As usual the issue was infront of the keyboard, in this case I had a reference to Abp.Configuration.Startup. AbpStartupConfigurationExtensions was therefore not available togeter with the extesion on .ReplaceService<,>.
Again many thanks for your swift response.
Kind regard Andreas
Dear Maliming
Thank you for your feedback. Sorry, maybe my question was missleading. I would like to understand how I should register my own implementation if IConnectionStringResolver because Configuration.ReplaceService<IConnectionStringResolver, myConnectionStringResolver>(); does not work anymore with APB 4.1.0.
Kind regards Andreas
Dear Maliming
Please as follow, the code is in the cwadmin.EntityFrameworkCore project, EntityFrameworkCore folder:
[DependsOn(
typeof(AbpZeroCoreEntityFrameworkCoreModule),
typeof(cwadminCoreModule),
typeof(AbpZeroCoreIdentityServerEntityFrameworkCoreModule)
)]
public class cwadminEntityFrameworkCoreModule : AbpModule
{
/* Used it tests to skip dbcontext registration, in order to use in-memory database of EF Core */
public bool SkipDbContextRegistration { get; set; }
public bool SkipDbSeed { get; set; }
public override void PreInitialize()
{
if (!SkipDbContextRegistration)
{
Configuration.ReplaceService<IConnectionStringResolver, myConnectionStringResolver>();
Configuration.Modules.AbpEfCore().AddDbContext<cwadminDbContext>(options =>
{
if (options.ExistingConnection != null)
{
cwadminDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
}
else
{
cwadminDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
}
});
Configuration.Modules.AbpEfCore().AddDbContext<cwTopologySwitchDbContext>(options =>
{
if (options.ExistingConnection != null)
{
cwTopologySwitchDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
}
else
{
cwTopologySwitchDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
}
});
Configuration.Modules.AbpEfCore().AddDbContext<cwCauDbContext>(options =>
{
if (options.ExistingConnection != null)
{
cwCauDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
}
else
{
cwCauDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
}
});
Configuration.Modules.AbpEfCore().AddDbContext<cwClientDbContext>(options =>
{
if (options.ExistingConnection != null)
{
cwClientDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
}
else
{
cwClientDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
}
});
}
// Uncomment below line to write change logs for the entities below:
Configuration.EntityHistory.Selectors.Add("cwadminEntities", EntityHistoryHelper.TrackedTypes);
Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(cwadminEntityFrameworkCoreModule).GetAssembly());
}
public override void PostInitialize()
{
var configurationAccessor = IocManager.Resolve<IAppConfigurationAccessor>();
using (var scope = IocManager.CreateScope())
{
if (!SkipDbSeed && scope.Resolve<DatabaseCheckHelper>().Exist(configurationAccessor.Configuration["ConnectionStrings:Default"]))
{
SeedHelper.SeedHostDb(IocManager);
}
}
}
}
It follows the recomendation for multiple databases found in https://stackoverflow.com/questions/49243891/how-to-use-multiples-databases-in-abp-core-zero/49572121#49572121
Kind regards Andreas