【发布时间】:2020-11-23 21:05:31
【问题描述】:
我目前正在使用this article 尝试将我的 ASP.NET Core 项目连接到我的 MySql 数据库,并按照它的说明安装了 NuGet 包“MySqlConnector”。然后文章说要将此行添加到 Startup.cs 中的“ConfigureServices”函数中。
services.AddTransient<MySqlConnection>(_ => new MySqlConnection(Configuration["ConnectionStrings:Default"]));
但是“MySqlConnection”是红色下划线,悬停在上面会显示以下错误:
CS0246: The type or namespace "MySqlConnection" could not be found (are you missing a using directive or an assembly reference?)
我有什么遗漏吗?文章中有错别字,我应该安装 MySqlConnection 包吗?
【问题讨论】:
标签: c# asp.net mysql-connector mysqlconnection