Activities of "Leonardo.Willrich"

Just as additional information, I've created a new MigrationService and implemented that. But, I still don't know how to distinguish the SeedContributor in each method. It is still calling the same class in both services.

He is my new Service being instanced and calling MigrateAsync.

public async Task StartAsync(CancellationToken cancellationToken)
        {
            using (var application = AbpApplicationFactory.Create<AvalancheOCPDbMigratorModule>(options =>
                {
                    options.UseAutofac();
                    options.Services.AddLogging(c => c.AddSerilog());
                }))
                {
                    application.Initialize();

                    await application
                        .ServiceProvider
                        .GetRequiredService<AvalancheOCPDbMigrationService>()
                        .MigrateAsync();

                    await application
                        .ServiceProvider
                        .GetRequiredService<AORDbMigrationService>()
                        .MigrateAsync();

                application.Shutdown();

                    _hostApplicationLifetime.StopApplication();
                }

        }

The problem is in the highlighted line. It is bringing all SeedContributor classes created.

public AORDbMigrationService(
            IDataSeeder dataSeeder,
            IEnumerable<IAORDbSchemaMigrator> dbSchemaMigrators,
            ITenantRepository tenantRepository,
            ICurrentTenant currentTenant)
        {
            _dataSeeder = dataSeeder; // -->> Return all list with all SeedContributor, and not the only one that is suppose to be for the DBContext
            _dbSchemaMigrators = dbSchemaMigrators;
            _tenantRepository = tenantRepository;
            _currentTenant = currentTenant;

            Logger = NullLogger<AORDbMigrationService>.Instance;
        }
  • ABP Framework version: v4.2.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

I have two DBContext in my application and I want to know how to use DBMigrator to apply migration for both DBContext? To create (add-migration) and to update the database (update-database) I am using the argument -context <dbcontext>. But, how it will be possible using DBMigrator? I want to seed my database using DBMigrator.

Showing 191 to 192 of 192 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11