• 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)。 
  • 相关阅读:
    【自然框架】——自然框架的命名空间
    【视频】配置信息管理 的 使用方法(四):功能节点维护
    【视频】配置信息管理 的 使用方法(二):建表、添加元数据
    论榜样的威力!
    【自然框架】——页面基类与设计模式(二) 模板模式
    当前登录人管理——UserManage源代码下载(2009.10.16更新)
    预防SQL注入攻击之我见
    【自然框架】—— 全貌
    【视频】配置信息管理 的 使用方法(一):数据库文档(Excel)的格式说明
    用QQ提问的技巧,用了之后可以提高效率,呵呵。
  • 原文地址:https://www.cnblogs.com/tgdjw/p/4837376.html
Copyright © 2020-2023  润新知