From 73db458263e55d2d7ac3d3361b2d13c5d9a2bcb6 Mon Sep 17 00:00:00 2001 From: Ma Liming Date: Thu, 23 Oct 2025 10:59:41 +0800 Subject: [PATCH 1/2] Update MySQL integration instructions for EF Core --- .../framework/data/entity-framework-core/mysql.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/en/framework/data/entity-framework-core/mysql.md b/docs/en/framework/data/entity-framework-core/mysql.md index 65bc1cb3b1..41ccf237a4 100644 --- a/docs/en/framework/data/entity-framework-core/mysql.md +++ b/docs/en/framework/data/entity-framework-core/mysql.md @@ -34,9 +34,18 @@ Alternatively, you can use the [Pomelo.EntityFrameworkCore.MySql](https://www.nu Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, replace `typeof(AbpEntityFrameworkCoreMySQLModule)` with `typeof(AbpEntityFrameworkCoreMySQLPomeloModule)` in the `DependsOn` attribute. -> Depending on your solution structure, you may find more code files need to be changed. +## UseMySQL() + +Find `UseSqlServer()` calls in your solution. Check the following files: -The `UseMySQL()` method calls remain the same, no changes needed. +* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. Replace `UseSqlServer()` with `UseMySql()`. +* *YourProjectName*DbContextFactory.cs inside the `.EntityFrameworkCore` project. Replace `UseSqlServer()` with `UseMySql()`. + +You also need to specify the `ServerVersion`, See https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/wiki/Configuration-Options#server-version for more details. + +`UseMySql(configuration.GetConnectionString("Default"), ServerVersion.AutoDetect(configuration.GetConnectionString("Default")));` or `UseMySql(configuration.GetConnectionString("Default"), new MySqlServerVersion(new Version(8, 4, 6)));` + +> Depending on your solution structure, you may find more code files need to be changed. ## Change the Connection Strings From b41f283a4a2b0b5c683a513f44468fa8f0ca6569 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Thu, 23 Oct 2025 06:39:22 +0000 Subject: [PATCH 2/2] Update mysql.md --- docs/en/framework/data/entity-framework-core/mysql.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/en/framework/data/entity-framework-core/mysql.md b/docs/en/framework/data/entity-framework-core/mysql.md index 41ccf237a4..f5254e2419 100644 --- a/docs/en/framework/data/entity-framework-core/mysql.md +++ b/docs/en/framework/data/entity-framework-core/mysql.md @@ -32,16 +32,18 @@ Find `UseSqlServer()` calls in your solution. Check the following files: Alternatively, you can use the [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql) provider. Replace the [Volo.Abp.EntityFrameworkCore.MySQL](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.MySQL) package with the [Volo.Abp.EntityFrameworkCore.MySQL.Pomelo](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.MySQL.Pomelo) package in your `.EntityFrameworkCore` project. -Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, replace `typeof(AbpEntityFrameworkCoreMySQLModule)` with `typeof(AbpEntityFrameworkCoreMySQLPomeloModule)` in the `DependsOn` attribute. +To complete the switch to the Pomelo Provider, you'll need to update your module dependencies. To do that, find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, replace `typeof(AbpEntityFrameworkCoreMySQLModule)` with `typeof(AbpEntityFrameworkCoreMySQLPomeloModule)` in the `DependsOn` attribute. -## UseMySQL() +Also, if you are switching from a provider other than ABP's MySQL provider, you need to call the `UseMySQL` method in the relevant places, as described in the next section. + +### UseMySQL() Find `UseSqlServer()` calls in your solution. Check the following files: * *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. Replace `UseSqlServer()` with `UseMySql()`. * *YourProjectName*DbContextFactory.cs inside the `.EntityFrameworkCore` project. Replace `UseSqlServer()` with `UseMySql()`. -You also need to specify the `ServerVersion`, See https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/wiki/Configuration-Options#server-version for more details. +You also need to specify the `ServerVersion`. See https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/wiki/Configuration-Options#server-version for more details. `UseMySql(configuration.GetConnectionString("Default"), ServerVersion.AutoDetect(configuration.GetConnectionString("Default")));` or `UseMySql(configuration.GetConnectionString("Default"), new MySqlServerVersion(new Version(8, 4, 6)));`