![](/img/trans.png)
[英]EF Core migration error with .NET Core Web API in Visual Studio Code
[英]EF Core 5 with Visual Studio for Mac
我已經使用 docker 容器在我的 OS X 中安裝了一個 Linux SQL Server 實例,並且我已經使用 VS Code 連接到了這個本地主機實例
但是我需要在 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();
}
我得到這個例外
請問有什么想法嗎?
謝謝
這是解決方案
optionsBuilder.UseSqlServer("Server=localhost, 1433; Database=Boletus;User=sa; Password=Windows2021!") .LogTo(Console.WriteLine, new[] { DbLoggerCategory.Database.Command.Name }, LogLevel.Information) . EnableSensitiveDataLogging();
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.