小编Hes*_*ari的帖子

在 C# 实体框架中的 sql 连接字符串中使用端口:不支持关键字:“port”

我一直在努力使用 VS 代码设置实体框架,使用本教程: https:
//www.learnentityframeworkcore.com/walkthroughs/aspnetcore-application
但是,在执行迁移时,我遇到了这个特定错误:关键字不受支持:到目前为止,
我找到的最好的帮助参考是这个 stackoverflow,但是,由于我迄今为止一直遵循的设置,所有解决方案似乎都不起作用
C# 实体框架:不支持关键字:'port '

这似乎是给我带来麻烦的代码:

using Microsoft.EntityFrameworkCore;
namespace EFPrac
{
    
    public class EFCoreWebDemoContext : DbContext
    {
        public DbSet<Book> Books { get; set; }
        public DbSet<Author> Authors { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {            
            string connectionString = "server=localhost;port=3306;database=EFpractice;uid=root,Pwd=****";
            optionsBuilder.UseSqlServer(connectionString);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)
我已经被困在这个问题上有一段时间了,所以任何帮助将不胜感激。

.net c# entity-framework visual-studio-code

5
推荐指数
1
解决办法
7881
查看次数

标签 统计

.net ×1

c# ×1

entity-framework ×1

visual-studio-code ×1