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)。 
  • 相关阅读:
    我的利器
    老树新芽——矩估计遇到神经网络
    QuantLib 金融计算——数学工具之随机数发生器
    《Implementing QuantLib》译后记
    c# 大批量用户访问数据库报错
    阿里云redis映射到阿里云服务器
    C# 输出字符串到文本文件中
    SQL Server 怎么在分页获取数据的同时获取到总记录数
    C# 当前 .NET SDK 不支持将 .NET Core 2.1 设置为目标。请将 .NET Core 2.0 或更低版本设置为目标,或使用支持 .NET Core 2.1 的 .NET SDK 版本。
    c# 项目之间循环引用vs弹窗提醒
  • 原文地址:https://www.cnblogs.com/tgdjw/p/4837376.html
Copyright © 2011-2022 走看看