مرجع دستورات Migrations در MVC C# Asp.net

Enable-Migrations

Enables Code First Migrations in a project.

Syntax

Enable-Migrations [-EnableAutomaticMigrations] [[-ProjectName] <String>]
  [-Force] [<CommonParameters>]

Description

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).

Parameters

-ENABLEAUTOMATICMIGRATIONS

Specifies whether automatic migrations will be enabled in the scaffolded migrations configuration. If ommitted, automatic migrations will be disabled.

-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.

-FORCE

Specifies that the migrations configuration be overwritten when running more than once for given project.

<COMMONPARAMETERS>

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type: get-help about_commonparameters.

Remarks

To see the examples, type: get-help Enable-Migrations -examples.
For more information, type: get-help Enable-Migrations -detailed.
For technical information, type: get-help Enable-Migrations -full.

Additional Information

The flag for enabling automatic migrations is saved in the Migrations\Configuration.cs file, in the constructor. To later change the option, just change the assignment in the file.

public Configuration()
{
    AutomaticMigrationsEnabled = false;
}

Add-Migration

Scaffolds a migration script for any pending model changes.

Syntax

Add-Migration [-Name] <String> [-Force]
  [-ProjectName <String>] [-StartUpProjectName <String>]
  [-ConfigurationTypeName <String>] [-ConnectionStringName <String>]
  [-IgnoreChanges] [<CommonParameters>]
 
Add-Migration [-Name] <String> [-Force]
  [-ProjectName <String>] [-StartUpProjectName <String>]
  [-ConfigurationTypeName <String>] -ConnectionString <String>
  -ConnectionProviderName <String> [-IgnoreChanges] [<Common Parameters>]

Description

Scaffolds a new migration script and adds it to the project.

Parameters

-NAME <STRING>

Specifies the name of the custom script.

-FORCE

Specifies that the migration user code be overwritten when re-scaffolding an existing migration.

-PROJECTNAME <STRING>

Specifies the project that contains the migration configuration type to be used. If ommitted, the default project selected in package manager console is used.

-STARTUPPROJECTNAME <STRING>

Specifies the configuration file to use for named connection strings. If omitted, the specified project’s configuration file is used.

-CONFIGURATIONTYPENAME <STRING>

Specifies the migrations configuration to use. If omitted, migrations will attempt to locate a single migrations configuration type in the target project.

-CONNECTIONSTRINGNAME <STRING>

Specifies the name of a connection string to use from the application’s configuration file.

-CONNECTIONSTRING <STRING>

Specifies the the connection string to use. If omitted, the context’s default connection will be used.

-CONNECTIONPROVIDERNAME <STRING>

Specifies the provider invariant name of the connection string.

-IGNORECHANGES

Scaffolds an empty migration ignoring any pending changes detected in the current model. This can be used to create an initial, empty migration to enable Migrations for an existing database. N.B. Doing this assumes that the target database schema is compatible with the current model.

<COMMONPARAMETERS>

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type: get-help about_commonparameters.

Remarks

To see the examples, type: get-help Add-Migration -examples.
For more information, type: get-help Add-Migration -detailed.
For technical information, type: get-help Add-Migration -full.

Update-Database

Applies any pending migrations to the database.

Syntax

Update-Database [-SourceMigration <String>]
  [-TargetMigration <String>] [-Script] [-Force] [-ProjectName <String>]
  [-StartUpProjectName <String>] [-ConfigurationTypeName <String>]
  [-ConnectionStringName <String>] [<CommonParameters>]
 
Update-Database [-SourceMigration <String>] [-TargetMigration <String>]
  [-Script] [-Force] [-ProjectName <String>] [-StartUpProjectName <String>]
  [-ConfigurationTypeName <String>] -ConnectionString <String>
  -ConnectionProviderName <String> [<CommonParameters>]

Description

Updates the database to the current model by applying pending migrations.

Parameters

-SOURCEMIGRATION <STRING>

Only valid with -Script. Specifies the name of a particular migration to use as the update’s starting point. If ommitted, the last applied migration in the database will be used.

-TARGETMIGRATION <STRING>

Specifies the name of a particular migration to update the database to. If ommitted, the current model will be used.

-SCRIPT

Generate a SQL script rather than executing the pending changes directly.

-FORCE

Specifies that data loss is acceptable during automatic migration of the
database.

-PROJECTNAME <STRING>

Specifies the project that contains the migration configuration type to be used. If ommitted, the default project selected in package manager console is used.

-STARTUPPROJECTNAME <STRING>

Specifies the configuration file to use for named connection strings. If omitted, the specified project’s configuration file is used.

-CONFIGURATIONTYPENAME <STRING>

Specifies the migrations configuration to use. If omitted, migrations will attempt to locate a single migrations configuration type in the target project.

-CONNECTIONSTRINGNAME <STRING>

Specifies the name of a connection string to use from the application’s configuration file.

-CONNECTIONSTRING <STRING>

Specifies the the connection string to use. If omitted, the context’s default connection will be used.

-CONNECTIONPROVIDERNAME <STRING>

Specifies the provider invariant name of the connection string.

<COMMONPARAMETERS>

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type: get-help about_commonparameters.

Remarks

To see the examples, type: get-help Update-Database -examples.
For more information, type: get-help Update-Database -detailed.
For technical information, type: get-help Update-Database -full.

Additional Information

The command always runs any pending code-based migrations first. If the database is still incompatible with the model the additional changes required are applied as an separate automatic migration step if automatic migrations are enabled. If automatic migrations are disabled an error message is shown.

Get-Migrations

Displays the migrations that have been applied to the target database.

Syntax

Get-Migrations [-ProjectName <String>] [-StartUpProjectName <String>]
  [-ConfigurationTypeName <String>] [-ConnectionStringName <String>]
  [<CommonParameters>]
 
Get-Migrations [-ProjectName <String>] [-StartUpProjectName <String>]
  [-ConfigurationTypeName <String>] -ConnectionString <String>
  -ConnectionProviderName <String> [<CommonParameters>]

Description

Displays the migrations that have been applied to the target database.

Parameters

-PROJECTNAME <STRING>

Specifies the project that contains the migration configuration type to be used. If ommitted, the default project selected in package manager console is used.

-STARTUPPROJECTNAME <STRING>

Specifies the configuration file to use for named connection strings. If omitted, the specified project’s configuration file is used.

-CONFIGURATIONTYPENAME <STRING>

Specifies the migrations configuration to use. If omitted, migrations will attempt to locate a single migrations configuration type in the target project.

-CONNECTIONSTRINGNAME <STRING>

Specifies the name of a connection string to use from the application’s configuration file.

-CONNECTIONSTRING <STRING>

Specifies the the connection string to use. If omitted, the context’s default connection will be used.

-CONNECTIONPROVIDERNAME <STRING>

Specifies the provider invariant name of the connection string.

<COMMONPARAMETERS>

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type: get-help about_commonparameters.

Remarks

To see the examples, type: get-help Get-Migrations -examples.
For more information, type: get-help Get-Migrations -detailed.
For technical information, type: get-help Get-Migrations -full.

Additional Information

The powershell commands are complex powershell functions, located in the tools\EntityFramework.psm1file of the Entity Framework installation. The powershell code is mostly a wrapper around theSystem.Data.Entity.Migrations.MigrationsCommands found in thetools\EntityFramework\EntityFramework.PowerShell.dll file. First a MigrationsCommands object is instantiated with all configuration parameters. Then there is a public method on the MigrationsCommandsobject for each of the available commands.





کلمات کلیدی
   مدیریت رجیستری در c#       facebook       حسابداری قرض الحسنه       توزیع       shared       بدست آوردن لیست VIEW در sql       english       mtp usb drive error       dilvak       login       hous       vmw       virtual machin       var       format       htaccess       dot net        vs2005       DotNetNuke       Search Engine Optimization       standard       style hack       install       include       yahoo       PASCAL       دوربین       دلیل استفاده ازمتن باز       new       ScriptMethod       memorye       int32       نرم افزار       dotnet4       sector       geteeventlistener       دامنه,dkn,cکsv,vک       افزونه دیکشنری و مترجم برای فایر فاکس       app       Registry       js       sleep        view        Process        پزشکی       vs2010       Bluetooth       html5       inode       show    

صفحات ما در فیس بوک

CSharp 



Google ++

طراحی وب سایتطراحی وب سایت با جدیدترین تکنولوژی های روز

طراحی و پیاده سازی وب سایتهای شخصی و تجاری و اداره ای با جدیدترین تکنولوژی های دنیا
به زبانهای

Asp.net{C#, Vb.Net, J#, Ajax}, Php{Html, Ajax}, js



بهینه سازی صفحات وببهینه سازی صفحات وب برای موتورهای جستجو

بهینه سازی صفحات وب برای موتور های جستجوگر برای افزایش بازدید و معرفی بهتر برای کاربران که به اصتلاح seo نامیده میشود

برنامه نویسیتولید و ساخت نرم افزار

ساخت انواع نرم افزارهی تحت ویندوز و وب و سرور و موبایل و میکروکنترلرها و... ساخت انواع سرویس دهنده های وب و سرور و ... ساخت انواع انالیزگرها و...