.NET Core如何使用MySQL?需要打什么驱动?
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/474
1. 安装EF Core连接MySQL的驱动,这里有两类:
(1).Oracle官方出品:MySql.Data.EntityFrameworkCore (版本:8.0.17)
(2).其他第三方出品:Pomelo.EntityFrameworkCore.MySql (版本:2.2.0)
8.0.11版本的官方包,大概会抛出这个错误:
The 'MySQLNumberTypeMapping' does not support value conversions. Support for value conversions typically requires changes in the database provider.
主要是不支持值转换吧,用第三方包可以解决。
如果你是.NET Core 2.1的话,
建议nuget包安装Pomelo.EntityFrameworkCore.MySql (版本:2.1.0)
2. 关于连接字符串:
This article was last edited at 2020-10-03 17:31:28