【发布时间】:2023-03-27 17:57:01
【问题描述】:
我一直在努力使用 VS 代码设置实体框架,使用本教程:
https://www.learnentityframeworkcore.com/walkthroughs/aspnetcore-application
但是,在执行迁移时,我遇到了这个特定的错误:不支持关键字:'port'
到目前为止,我找到的最好的参考是这个 stackoverflow,但是,由于我一直在关注的设置到目前为止,似乎没有一个解决方案有效
C# Entity Framework: Keyword not supported: '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);
}
}
}
我已经坚持了一段时间,所以任何帮助将不胜感激。
【问题讨论】:
标签: c# .net entity-framework visual-studio-code