Entity framework 7 in ASP.NET MVC6 multiple foreign key to the same table

后端 未结 2 1020
我在风中等你
我在风中等你 2021-01-19 00:04

Hi I have the same problem that an old post that is here, the solution offer there doesn\'t work for me in MVC 6 with EF7 is simple

public class Match
{
            


        
2条回答
  •  花落未央
    2021-01-19 00:34

    If you prefer you can create on database manually this FK with cascade delete, and check why you are havign this circular cascade loop. To understand that we need the other tables or the database structure involved. Please inspect your database (with a diagram for example), draw down your connected tables, your FKs and for each study the operation you planned (cascade delete, no action, ...) and the direction of them. You fill find a loop when you will try to insert that FK in error.

    The next phase is to understand if you want it or not, is an unwanted database design? Or simply you don't need this FK action? In this case you can suppress it in various levels: on model, on settings, ... se the other post or the EF guide for that.

提交回复
热议问题