From 73db458263e55d2d7ac3d3361b2d13c5d9a2bcb6 Mon Sep 17 00:00:00 2001 From: Ma Liming Date: Thu, 23 Oct 2025 10:59:41 +0800 Subject: [PATCH] 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