Starts in:
0 DAY
3 HRS
30 MIN
45 SEC
Starts in:
0 D
3 H
30 M
45 S

Activities of "a3x"

In the article you describe: < In this version, ABP Framework provides base classes and events to migrate the database schema and seed the database on application startup. This system works compatibly with multi-tenancy and whenever a new tenant is created or a tenant's database connection string has been updated, it checks and applies database migrations for the new tenant state.

This system is especially useful to migrate databases for microservices. In this way, when you deploy a new version of a microservice, you don't need to manually migrate its database.

You need to take the following actions to use the database migration system:

Create a class that derives from EfCoreRuntimeDatabaseMigratorBase class, override and implement its SeedAsync method. And lastly, execute the CheckAndApplyDatabaseMigrationsAsync method of your class in the OnPostApplicationInitializationAsync method of your module class. Create a class that derives from DatabaseMigrationEventHandlerBase class, override and implement its SeedAsync method. Then, whenever a new tenant is created or a tenant's connection string is changed then the SeedAsync method will be executed. >

I like to see a practcal implementation how to implement the described steps in a MVC application.

I know, however, in the post mentioned above you describe the new feature "In this version, ABP Framework provides base classes and events to migrate the database schema and seed the database on application startup. This system works compatibly with multi-tenancy and whenever a new tenant is created or a tenant's database connection string has been updated, it checks and applies database migrations for the new tenant state."

I like to have an practical example here how to implement it :)

Hi,

ok, bit of a shame that I have to rewrite all the tests now.

2 more questions:

  1. can you tell when the templates for the suite will be adjusted to match your pattern?
  2. what exactly was changed between the 6.x and the 7.0 that leads to this behavior? Is it due to .NET 7 or what change was there in the abp.io framework?

Hi, Thanks this works for me. However, for my real project, I have a lot of seed methods. Is there any other way than adding the if condition to every insert statement now? In addition: In my project I have tests like following which fail with the same error. What should I do here?

[Fact]
    public async Task CreateAsync()
    {
        // Arrange
        var input = new CustomerCreateDto
        {
            Name = "bf64c99897834",
            Street = "30b28c8ff57b464d9bc2f5618f15be1c75930a933aa140cb80f614f124bb3f0461f45",
            Postcode = "aa2e0879154b4a2bbf78597283eb7e57",
            City = "5f4242b5aa61476a97c3e5af411cf498521949a2ad2c47edbbbe",
            Country = "c83c88797e63411f882bdd48759e99e87679b076e154472482c6e885b56830cf82abbd257b894cd0a8588a73ad277e3c7c6d",
            VATNo = "d6d31592918a4f0f96ee23ad51a87e0ab5b0f1b49ccb41acbf85136106af9ba445de4a676ed14b4db27c63267679c6d8def4",
            Status = default,
            State = "76d47ce8de444b898aa5565717a4f154c746171559174f87a9fff21f832690097571c7457c7544b3a3041662529c371a881e"
        };

        // Act
        var serviceResult = await _customersAppService.CreateAsync(input);
    

        // Assert
        var result = await _customerRepository.FindAsync(c => c.Id == serviceResult.Id);

        result.ShouldNotBe(null);
        result.Name.ShouldBe("bf64c99897834");
        result.Street.ShouldBe("30b28c8ff57b464d9bc2f5618f15be1c75930a933aa140cb80f614f124bb3f0461f45");
        result.Postcode.ShouldBe("aa2e0879154b4a2bbf78597283eb7e57");
        result.City.ShouldBe("5f4242b5aa61476a97c3e5af411cf498521949a2ad2c47edbbbe");
        result.Country.ShouldBe("c83c88797e63411f882bdd48759e99e87679b076e154472482c6e885b56830cf82abbd257b894cd0a8588a73ad277e3c7c6d");
        result.VATNo.ShouldBe("d6d31592918a4f0f96ee23ad51a87e0ab5b0f1b49ccb41acbf85136106af9ba445de4a676ed14b4db27c63267679c6d8def4");
        result.Status.ShouldBe(default);
        result.State.ShouldBe("76d47ce8de444b898aa5565717a4f154c746171559174f87a9fff21f832690097571c7457c7544b3a3041662529c371a881e");
    }

Yes, I created a new solution from template, pasted my applicationmodule staff and created a entity. Please find the source here:

The tests also here randomly fails:

Hey,

Yes, it does: and it does not throw any exception

Best regards

Showing 1 to 6 of 6 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06