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)。 
  • 相关阅读:
    ASP.net2.0中的特殊文件App_global.asax.compiled
    Enterprise Library 2.0中log文件大小设置
    尝试读取或写入受保护的内存,这通常指示其它内存已损坏
    没有钱的生活
    如何把java项目打包成war包
    常用的正则表达式
    最简单的oracle10g手工建库步骤
    rman复制数据库ORA01547ORA01194ORA01110,强制打开并修改日志文件
    oracle 10g 的max函数的bug
    PL/SQL Developer 使用错误的tnsnames.ora,如何修改?
  • 原文地址:https://www.cnblogs.com/tgdjw/p/4837376.html
Copyright © 2011-2022 走看看