I want to create 2 tables: Team, Match, where in the Match table there are 2 references to the Team table. When I try to generate a database, I get an error related to cascade deletion. Can you tell me how to solve the problem?
public class Team { public int Id { get; set; } public string Name { get; set; } } public class Match { public int Id { get; set; } public int? HomeId { get; set; } public int? GuestId { get; set; } public Team Home { get; set; } public Team Guest { get; set; } }
.OnDelete(DeleteBehavior.Restrict)in modelBinder. Theory here: metanit.com/sharp/entityframeworkcore/3.2.php - AK ♦