实体框架在sql-express(或azure)上向下迁移

问题描述 投票:0回答:1

我将Entity Framework 6与Code-First配置AutomaticMigrationsEnabled=true并且希望对托管在SQL-express服务器中的数据库执行向下迁移。

在调试模式下,我可以使用Visual Studio控制台并执行“ Update-Database -TargetMigration myMigration”,但是使用SQL-express数据库怎么办?

c# entity-framework entity-framework-6 sql-server-express ef-migrations
1个回答
0
投票

我在NuGet Pagage Manager控制台类型中找到了向下迁移SQL Express数据库的解决方案:

Update-Database 
-TargetMigration {migrationName} 
-ConnectionString "Data Source=.\SQLExpress;Initial Catalog={databaseName};Integrated Security=True;Pooling=False" 
-ConnectionProviderName "System.Data.SqlClient" 
-Verbose
© www.soinside.com 2019 - 2024. All rights reserved.