如何使用 ASP ABP 在 Azure 中迁移?

How to migrate in Azure using ASP ABP?

在使用 Azure SQL 服务器时,我们如何使用 ABP 进行迁移?

我试过了 myDbContext.Database.Migrate(); 但 myDbContext 需要一个选项文件。

我尝试使用 Update-Database 但它不想接受 ConnectionString。

我尝试在发布时启用迁移,但由于某些未知原因,没有 "Migrate database on startup" 选项...很奇怪。

正确的做法是什么? SQL 个脚本?

您可以将连接字符串传递给 Update-Database 命令。 方法如下;

Update-Database -Verbose -ConnectionString "Server=localhost;Database=MyDatabase;User=sa;Password=123;" -ConnectionProviderName "System.Data.SqlClient"

这是与 Update-Database

的示例 Azure 数据库连接
Update-Database -StartUpProjectName "MyCloudProject" -ConnectionString "Server=tcp:<server_name>.database.windows.net,1433;Database=<database_name>;User ID=<db_user_name>@<server_name>;Password=<password>;Trusted_Connection=False;Encrypt=True;MultipleActiveResultSets=True;Max Pool Size=100;" -ConnectionProviderName "System.Data.SqlClient"