JetBrains Rider 2024.2 Help

Entity Framework and EF Core

Visual interface for EF Core commands

In Entity Framework Core projects, JetBrains Rider helps execute dotnet EF Core commands using a visual interface. Each command has a dedicated dialog that autofills most arguments, provides fields for all arguments that are allowed, and ensures that all required arguments are specified.

Execute EF Core commands

  • Select Tools | Entity Framework Core | [command name] from the main menu.

  • Right-click the desired project in the Solution Explorer and choose Entity Framework Core | [command name].

Troubleshooting

Project does not appear in the 'Startup projects' field

Check that the desired project satisfies the following requirements:

  • Microsoft.EntityFrameworkCore.Design or Microsoft.EntityFrameworkCore.Tools NuGet package is installed.

  • Project's target framework is at least netcoreapp3.1.

dotnet ef tools installed globally are not working from the terminal

If you see the following message:

Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET program, but dotnet-xyz does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Make sure that .dotnet/tools folder is included in the PATH environment variable. For more information, see this troubleshooting guide.

On Windows, you can also run the .NET SDK installer with the 'Repair' option.

Code inspections

JetBrains Rider provides the following code inspections for code issues specific to Entity Framework projects:

If you do not find some or all of these inspections helpful, you can clear the Enable Entity Framework-specific inspections checkbox on the Editor | Inspection Settings | Entity Framework page of JetBrains Rider settings Ctrl+Alt+S, or alternatively, you can disable only model-specific or only query-specific inspections on that page.

On that settings page, you can also list FQNs (fully qualified names) of database context classes (classes inherited from DbContext) that will be ignored during code analysis for identifying N+1, incomplete data, and other related issues.

You can click Add above the table to specify FQNs manually, or you can press Alt+Enter in the editor at the corresponding highlighting and choose to ignore the related context class:

JetBrains Rider: Disabling Entity Framework inspections for a DB context class from the 'Alt+Enter' menu
Last modified: 09 September 2024