Base solution for your next web application

Activities of "schneana"

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&lt;IConnectionStringResolver, myConnectionStringResolver&gt;();

            Configuration.Modules.AbpEfCore().AddDbContext&lt;cwadminDbContext&gt;(options =>
            {
                if (options.ExistingConnection != null)
                {
                    cwadminDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                }
                else
                {
                    cwadminDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                }
            });

            Configuration.Modules.AbpEfCore().AddDbContext&lt;cwTopologySwitchDbContext&gt;(options =>
            {
                if (options.ExistingConnection != null)
                {
                    cwTopologySwitchDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                }
                else
                {
                    cwTopologySwitchDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                }
            });

            Configuration.Modules.AbpEfCore().AddDbContext&lt;cwCauDbContext&gt;(options =>
            {
                if (options.ExistingConnection != null)
                {
                    cwCauDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                }
                else
                {
                    cwCauDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                }
            });


            Configuration.Modules.AbpEfCore().AddDbContext&lt;cwClientDbContext&gt;(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&lt;IAppConfigurationAccessor&gt;();

        using (var scope = IocManager.CreateScope())
        {
            if (!SkipDbSeed && scope.Resolve&lt;DatabaseCheckHelper&gt;().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

Dear Support

Sorry, I am sure I am overlooking something but in 4.0.2 I used in the ApbModule:

public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.ReplaceService&lt;IConnectionStringResolver, myConnectionStringResolver>(); ...

but this is not working anymore (I assume the ReplaceService notation changed in AbpModule). Can you please point me to the correcty way to use an own IConnectionStringResolver (ASP.NET MVC CORE + JQUERY) ?

Kind regards Andreas

<br> <br>

Showing 1 to 5 of 5 entries