Add-Migration

add-migration ArchiveProduct -connectionstring "server=localhost;database=intranet495;trusted_connection=true" -connectionprovidername "System.Data.SqlClient"

-Name <String>

Specifies the name of the custom script.

-Force [<SwitchParameter>]

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.

Last updated: 5/10/2022 3:27:40 PM

On this page

Latest Updates

© 0 - 2025 - Mike Brind.
All rights reserved.
Contact me at Mike dot Brind at Outlook.com