【问题标题】:EF Core 5 with Visual Studio for MacEF Core 5 与 Visual Studio for Mac
【发布时间】:2021-12-18 13:44:31
【问题描述】:

我已经使用 docker 容器在我的 OS X 中安装了一个 Linux SQL Server 实例,并且我已经使用 VS Code 连接到这个 localhost 实例

但我需要在 VS for Mac 中连接到它来开发我的 EF Core 项目,我不知道这是否可能,因为当我在我的 DbContext 中尝试这个时

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer("Data Source=localhost;Initial Catalog=Boletus;Integrated Security=True")
            .LogTo(Console.WriteLine, new[] { DbLoggerCategory.Database.Command.Name }, LogLevel.Information)
            .EnableSensitiveDataLogging();
    }

我得到了这个异常

有什么想法吗?

谢谢

【问题讨论】:

    标签: entity-framework-core entity-framework-core-5 entity-framework-core-5.0


    【解决方案1】:

    解决办法

    optionsBuilder.UseSqlServer("Server=localhost, 1433; Database=Boletus;User=sa; Password=Windows2021!") .LogTo(Console.WriteLine, new[] { DbLoggerCategory.Database.Command.Name }, LogLevel.Information) .EnableSensitiveDataLogging();

    谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多