zoukankan      html  css  js  c++  java
  • EF数据迁移

    http://www.cnblogs.com/stevenhqq/archive/2013/04/18/3028350.html

    解决方案多项目情况下的数据迁移,需要写完整路径名。

    PM> Enable-Migrations -ContextTypeName "解决方案.项目.Model.EntityContext" -ProjectName "解决方案.项目.Model" -StartUpProjectName "解决方案.项目.MVC" -ConnectionStringName "DefaultConnection" -Force

    PM> Add-Migration -Name "1"  -ProjectName "解决方案.项目.Model" -StartUpProjectName "解决方案.项目.MVC" -ConnectionStringName "DefaultConnection" -Force

    PM>Update-Database  -ProjectName "解决方案.项目.Model" -StartUpProjectName "解决方案.项目.MVC" -ConnectionStringName "DefaultConnection"  -Force

    名称
        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)。 
  • 相关阅读:
    HDU 4291 A Short problem 第37届ACM/ICPC 成都赛区网络赛1004题 (找规律,取模求循环节)
    POJ 1276 Cash Machine(多重背包)
    HDU 4296 Buildings 第37届ACM/ICPC 成都赛区网络赛1009题 (贪心)
    POJ 2392 Space Elevator (多重背包)
    Mysql配置SSL
    error C2471: cannot update program database vc90.pdb
    Android 总结 转载
    MAX SDK的INode的变换矩阵,以及Object的一些常识
    C++游戏开发需要阅读的书籍
    游戏程序员养成计划
  • 原文地址:https://www.cnblogs.com/tgdjw/p/4837376.html
Copyright © 2011-2022 走看看