ReSharper 2024.2 Help

Entity Framework

By default, ReSharper helps you identify Entity Framework or EF Core entities by marking them with special adornments:

ReSharper: Editor adornment for EF entity class

You can disable these adornments by right-clicking and choosing the corresponding option. Alternatively, you can use the corresponding checkbox on the Code Inspection | Entity Framework page of ReSharper options Alt+R, O.

Entity Relationship diagram

For an Entity Framework or EF Core project, you can create a graphic representation of the database model and the relationships between entities, including one-to-one and one-to-many relationships.

Build Entity Relationship diagram

  • Right-click the editor adornment next to any EF entity and choose Show Entity Relationship Diagram.

  • If the adornments are disabled, choose ReSharper | Architecture | Show Entity Relationship Diagram from the main menu.

ReSharper: Entity relationship diagram

Relationships between entities are displayed using Crow's foot notation. The diagram also highlights potential problems of specific fields:

Code inspections

ReSharper 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 Code Inspection | Entity Framework page of ReSharper options Alt+R, O, 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:

ReSharper: Disabling Entity Framework inspections for a DB context class from the 'Alt+Enter' menu
Last modified: 25 April 2024