Relationships in EF Core

Cascade Delete in Entity Framework Core

Entity Framework Core Cascade Delete is one of the Referential actions. These actions specify what to do with the related rows when we delete the parent row. We can configure these actions in the database and in the EF core (Client). The options available to use are Delete the related rows (Cascade / ClientCascade), Update its Foreign Key to NULL (SetNull / ClientSetNull) or do nothing (Restrict/ NoAction / ClientNoAction). We setup delete behavior between entities using the FluentAPI OnDelete method.

Cascade Delete in Entity Framework Core Read More »

Relationships & Navigation Properties in EF Core

In relational databases, it is a healthy practice to divide the data between related tables. For Example, the employee working in a particular department. We do not store both the information in the same table but divide them into Employee & Department table. When we divide tables, we also need to specify the relationships between them. For example, if you are looking for an employee working in a particular department, then you need to specify the relationship between employees and the department table. The relationship between these tables is defined using the foreign keys. We then use these relationships to query the database to get the meaningful data.

Relationships & Navigation Properties in EF Core Read More »

Scroll to Top