Hoy Cheung
Hoy Cheung

Reputation: 1670

How to use ef6.exe

I'm a newbie in entity framework. I have seen examples of using migrate.exe or enable-migration etc.

But migrate.exe does not exist any more. I explored the web and found that ef6.exe replaced the old migrate.exe

so I tried

ef6 -contexttypename musicstoredatacontext
ef6 -context musicstoredatacontext

nothing worked

I cannot find further support/documentation regarding the migration commands. and i'm new to migration.

Can somebody give me some hint how to work on it?

Upvotes: 9

Views: 7184

Answers (3)

Icewindq Liu
Icewindq Liu

Reputation: 101

use the command help to get the docs

ef6 --help

or

ef6.exe migrations --help

Upvotes: 4

derekbaker783
derekbaker783

Reputation: 9610

"If you execute Update-Database -Verbose inside Visual Studio's Package Manager Console, it will show you the call it uses to ef.exe to apply migrations." -Brice Lambson

It will be something like:

<PATH_TO_EXE>\ef6.exe database update --connection-string "<CONNECTION_STRING>" --connection-provider System.Data.SqlClient --verbose --no-color --prefix-output --assembly <PATH_TO_DLL> --project-dir <PATH_TO_PROJECT_DIR> --language C# --data-dir <PATH_TO_APP_DATA> --root-namespace <NAMESPACE> --config <PATH_TO_WEB_CONFIG>

Some of the arguments above can be omitted.

You can use the same strategy to determine how to create a migration (Add-Migration) with ef6.exe.

SOURCE: https://github.com/dotnet/ef6/issues/1365#issuecomment-540067758

Upvotes: 9

Hoy Cheung
Hoy Cheung

Reputation: 1670

I succeeded in adding migration by updating powershell and use add-migration initial command

Reference can be found here.

https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet

Upvotes: -1

Related Questions