Large Update of the EF Core UI plugin for JetBrains Rider

Large Update of the EF Core UI plugin for JetBrains Rider

2022, Aug 14    

222.0.0 is the biggest update to the EF Core UI plugin for Rider. In addition to the changed versioning policy, it consists almost entirely of community-suggested features. In this article I would like to consider them in a little more detail.

At the time of writing this article, patch 222.1.0 has been released, which complements the main release and fixes bugs.

To be able to update to the latest version of the plugin, Rider must be updated to version 2022.2.0 or higher.

Generate SQL Script command dialog

EF Core allows you to generate SQL scripts from migrations in order to later use them when working with the database directly. The command requires quite a few parameters to execute with the desired behavior, so having a UI can make it easier to use.

Let’s take a closer look at the new Generate SQL Script dialog box:

  • From migration: migration from which to start “slicing” (exclusive). By default equals to ‘0’ (means “before the first migration”).
  • To migration: migration to which the “slice” should be made (inclusive). By default, this is the latest (the most recent) migration.
  • Output file: file where the result of the script generation will be written. The path is relative to the solution folder.
  • Make script idempotent: if this option is selected, the script will be idempotent. You can read more about idempotency here.
  • No transactions: if this option is selected, no transactions will be generated for the script. This option will not be available on projects where the EF Core version is below 5.0.

Support for dotnet ef local tool

In previous versions, the plugin relied on dotnet ef which is installed globally on the system. This is not always suitable if a developer has several projects that are completely different in age and are linked to different versions of EF Core Tools.

Now, when executing each command, the dialog box will display the version, as well as the source of the FE Core Tools that are used.

For local EF Core Tools to be correctly recognized, they must be installed at the solution level:

If the local tools were not found, the global ones will be used, as before:

Preview commands before execution

Sometimes it becomes necessary to look at what an EF Core command will look like before it is actually executed. For example, if you are not entirely sure that you specified the parameters correctly, and the command itself may seem non-obvious.

In the new version of the plugin, in each dialog box, you can click on the Preview button to see the console command with all the arguments passed:

In addition, the Working directory is indicated, which the plugin will use when executing the command.

Additional command line arguments support

Many faced the problem of not being able to pass command line arguments to the startup project when executing a command. For example, it is extremely useful to pass a environment, such as --environment Development, which will allow you to migrate immediately in a specific environment.

EF Core allows you to pass such arguments, and now it’s possible in a plugin! Each dialog box now has an Additional arguments field:

.NET Standard 2.0 support for Migrations projects

Thanks to @Sander0542, plugin now supports .NET Standard 2.0 target framework for Migrations project in dropdowns.

If you want to help plugin grow - you are always welcome! Feel free to pick-up an open issue or implement your favorite feature and open a PR.

A few words about new version format

As you can see, plugin versioning looks different now. This is due to the fact that the previous format could not contain information about which version of Rider a particular version of the plugin fits. This created non-obvious compatibility problems.

Now, the first number (e.g. 222) will be the Rider version (e.g. 2022.2), and the next number will be the major update and patch version, respectively.

This approach will allow more obvious support for releases under previous releases of Rider and will make it easier to navigate through plugin versions.

In addition, the branch policy used in the plugin repository on GitHub has also changed. master and develop have been deprecated as they created problems when developing in parallel for different versions of Rider at the same time. Now a release branch will be created for every major Rider release, e.g. release/222, from which the release will be built and deployed.

Bugfixes

We fixed a bunch of bugs in scope of currently released 222.* milestones. Full list is available in our changelog.

If you like my work or want a special kind of technical support for one of the projects I made, you could support me on GitHub! :heart:

Sponsor seclerp