Rider. EF Code First Migrations
Asked Answered
P

4

15

Is there an easy way to scaffold migrations using old EF outside of Visual Studio? I would like to do it via Rider IDE if it possible.

Pyrotechnic answered 3/1, 2018 at 22:23 Comment(1)
You can run migrations with migrate.exe. Also, specify EF6 vs EF Core.Lupelupee
T
13

I don't see these options related to ef core. The plugin makes sense.

(For MacOS, be sure, your dotnet root folder path is /usr/local/share/dotnet/. I'm telling this because Rider installs and places it in another folder. Further it gives rise ef to not work properly. You can see your dotnet folder on terminal by writing which dotnet)

Installing that plugin, enter image description here

Then,

enter image description here

Tenorrhaphy answered 27/1, 2022 at 18:49 Comment(0)
S
3

For EF Core, you can use https://blog.jetbrains.com/dotnet/2017/08/09/running-entity-framework-core-commands-rider/

For EF 6 you may want to check https://blog.jetbrains.com/dotnet/2018/04/06/entity-framework-support-rider-2018-1/

Starobin answered 4/1, 2018 at 5:43 Comment(2)
But with migrate.exe for EF 6 how can I make update-database or add-migration?Illaffected
Check blog.jetbrains.com/dotnet/2018/04/06/… for EF6Starobin
R
3

You can also use a jetbrains plugin made for handling migrations

https://plugins.jetbrains.com/plugin/17026

Rocray answered 18/6, 2021 at 13:21 Comment(0)
T
0

The Package Manager Console tools such as Add-Migration, Scaffold-DbContext commands are PowerShell-based, and the Package Manager Console ties to several Visual Studio-specific objects making it impossible to host it elsewhere - in your case Rider.

In Rider's terminal or anywhere outside of Visual Studio, you can use CLI tools. Equivalents to the highlighted commands would be respectively:

  • Add-Migration => dotnet ef migrations add MigrationName
  • Scaffold-DbContext => dotnet ef dbcontext scaffold

You can get more details on JetBrains blog: Running EF Core commands in Rider

Trapezium answered 30/1, 2022 at 15:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.