Skip to content

Commit 5f24e3a

Browse files
authored
Merge pull request #24036 from abpframework/maliming-patch-3
Update MySQL integration instructions for EF Core
2 parents 68b14cd + b41f283 commit 5f24e3a

File tree

1 file changed

+14
-3
lines changed
  • docs/en/framework/data/entity-framework-core

1 file changed

+14
-3
lines changed

docs/en/framework/data/entity-framework-core/mysql.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,22 @@ Find `UseSqlServer()` calls in your solution. Check the following files:
3232

3333
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.
3434

35-
Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, replace `typeof(AbpEntityFrameworkCoreMySQLModule)` with `typeof(AbpEntityFrameworkCoreMySQLPomeloModule)` in the `DependsOn` attribute.
35+
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.
3636

37-
> Depending on your solution structure, you may find more code files need to be changed.
37+
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.
38+
39+
### UseMySQL()
40+
41+
Find `UseSqlServer()` calls in your solution. Check the following files:
3842

39-
The `UseMySQL()` method calls remain the same, no changes needed.
43+
* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. Replace `UseSqlServer()` with `UseMySql()`.
44+
* *YourProjectName*DbContextFactory.cs inside the `.EntityFrameworkCore` project. Replace `UseSqlServer()` with `UseMySql()`.
45+
46+
You also need to specify the `ServerVersion`. See https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/wiki/Configuration-Options#server-version for more details.
47+
48+
`UseMySql(configuration.GetConnectionString("Default"), ServerVersion.AutoDetect(configuration.GetConnectionString("Default")));` or `UseMySql(configuration.GetConnectionString("Default"), new MySqlServerVersion(new Version(8, 4, 6)));`
49+
50+
> Depending on your solution structure, you may find more code files need to be changed.
4051
4152
## Change the Connection Strings
4253

0 commit comments

Comments
 (0)