The model:
public class AccountUser
{
public long AccountUserId { get; set; }
...
public long UserPermissionGroupId { get; set; }
public UserPermissionGroup UserPermissionGroup { get; set; }
}
public class UserPermissionGroup
{
public long UserPermissionGroupId { get; set; }
...
public string Name { get; set; }
}
The question: How do I set foreign key on table AccountUser->UserPermissionGroup to restrict on delete?
I'm unable to find example how to set foreign key on delete action to restrict to only one table. I can not use something like WithMany/WithOne and then OnDelete as in this example https://learn.microsoft.com/en-us/ef/core/modeling/relationships#cascade-delete-1 because I have no reference from UserPermissionGroup back to AccountUser.
Thank you very much.