标签:
http://www.cnblogs.com/stevenhqq/archive/2013/04/18/3028350.html
解决方案多项目情况下的数据迁移,需要写完整路径名。
PM> Enable-Migrations -ContextTypeName "Huasuda.IntelligenceCommunity.Model.EntityContext" -ProjectName "Huasuda.IntelligenceCommunity.Model" -StartUpProjectName "Huasuda.IntelligenceCommunity.MVC" -ConnectionStringName "DefaultConnection" -Verbose
PM> Add-Migration -Name "1" -ProjectName "Huasuda.IntelligenceCommunity.Model" -StartUpProjectName "Huasuda.IntelligenceCommunity.MVC" -ConnectionStringName "DefaultConnection" -Verbose
PM>Update-Database -ProjectName "Huasuda.IntelligenceCommunity.Model" -StartUpProjectName "Huasuda.IntelligenceCommunity.MVC" -ConnectionStringName "DefaultConnection" -Verbose
名称 Enable-Migrations 摘要 Enables Code First Migrations in a project. 语法 Enable-Migrations [-ContextTypeName <String>] [-EnableAutomaticMigrations] [-ProjectName <String>] [-StartUpProjectName <String>] [-Conne ctionStringName <String>] [-Force] [<CommonParameters>] Enable-Migrations [-ContextTypeName <String>] [-EnableAutomaticMigrations] [-ProjectName <String>] [-StartUpProjectName <String>] -Connec tionString <String> -ConnectionProviderName <String> [-Force] [<CommonParameters>] 说明 Enables Migrations by scaffolding a migrations configuration class in the project. If the target database was created by an initializer, an initial migration will be created (unless automatic migrations are enabled via the EnableAutomaticMigrations parameter). 参数 -ContextTypeName <String> Specifies the context to use. If omitted, migrations will attempt to locate a single context type in the target project. 是否必需? False 位置? named 默认值 是否接受管道输入? false 是否接受通配符? False -EnableAutomaticMigrations [<SwitchParameter>] Specifies whether automatic migrations will be enabled in the scaffolded migrations configuration. If ommitted, automatic migrations will be disabled. 是否必需? False 位置? named 默认值 False 是否接受管道输入? false 是否接受通配符? False -ProjectName <String> Specifies the project that the scaffolded migrations configuration class will be added to. If omitted, the default project selected in package manager console is used. 是否必需? False 位置? named 默认值 是否接受管道输入? false 是否接受通配符? False -StartUpProjectName <String> Specifies the configuration file to use for named connection strings. If omitted, the specified project‘s configuration file is used. 是否必需? False 位置? named 默认值 是否接受管道输入? false 是否接受通配符? False -ConnectionStringName <String> Specifies the name of a connection string to use from the application‘s configuration file. 是否必需? False 位置? named 默认值 是否接受管道输入? false 是否接受通配符? False -ConnectionString <String> Specifies the the connection string to use. If omitted, the context‘s default connection will be used. 是否必需? True 位置? named 默认值 是否接受管道输入? false 是否接受通配符? False -ConnectionProviderName <String> Specifies the provider invariant name of the connection string. 是否必需? True 位置? named 默认值 是否接受管道输入? false 是否接受通配符? False -Force [<SwitchParameter>] Specifies that the migrations configuration be overwritten when running more than once for a given project. 是否必需? False 位置? named 默认值 False 是否接受管道输入? false 是否接受通配符? False <CommonParameters> 此 Cmdlet 支持常见参数: Verbose、Debug、 ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、PipelineVariable 和 OutVariable。有关详细信息,请参阅 about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216)。
标签:
原文地址:http://www.cnblogs.com/tgdjw/p/4837376.html