Browse Source

Update article with DB mapping and migration images

Added a section on configuring the database mapping in the base DbContext class and included instructions for adding EF Core migrations using ABP Studio. Added three illustrative screenshots to support the migration steps.
pull/23161/merge
Halil İbrahim Kalkan 7 months ago
parent
commit
1ed90fb15c
  1. 31
      docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/POST.md
  2. BIN
      docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/abp-studio-add-migration-select-dbcontext.png
  3. BIN
      docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/abp-studio-add-migration-set-name.png
  4. BIN
      docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/abp-studio-add-migration.png

31
docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/POST.md

@ -237,6 +237,37 @@ namespace MtDemoApp
}
````
### Configuring the Database Mapping
Open the `MtDemoAppDbContextBase` class and add the following configuration inside the `OnModelCreating` method:
````csharp
builder.Entity<Product>(b =>
{
b.ToTable("Products");
b.ConfigureByConvention(); //auto-configure for the base class properties
b.Property(x => x.Name).IsRequired().HasMaxLength(100);
});
````
We made the configuration in the base class since the `Products` table should be created in all databases, not only in the main database.
### Add a New Database Migration
To add a new EF Core database migration, we can use ABP Studio UI, or EF Core command-line commands. I will show both of these approaches here.
#### Use ABP Studio to Add Database Migrations
...
![abp-studio-add-migration](abp-studio-add-migration.png)
...
![abp-studio-add-migration-set-name](abp-studio-add-migration-set-name.png)
...
![abp-studio-add-migration-select-dbcontext](abp-studio-add-migration-select-dbcontext.png)
TODO

BIN
docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/abp-studio-add-migration-select-dbcontext.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/abp-studio-add-migration-set-name.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
docs/en/Community-Articles/2025-07-26-Separate-Tenant-Schema/abp-studio-add-migration.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Loading…
Cancel
Save