简体   繁体   中英

FOREIGN KEY constraint may cause cycles or multiple cascade paths. error

I have 4 tables StokCard table StokGroup table GroupFeature table and StokCardAdditionalFeatureValue table All tables getting Primary Key from BaseModel But I am getting this error

Error is here

public class StokCard : BaseModel
{
        public string IPMKodu { get; set; }
        public int StokGroupId { get; set; }
        public StokGroup StokGroup { get; set; }
        ........................................ other properties
}

public class StokGroup:BaseModel
{
        public string GroupName { get; set; }
        public List<GroupFeature> GroupFeatures { get; set; }
        public List<StokCard> StokCards { get; set; }
}
public class GroupFeature : BaseModel
{
        public int StokGroupId { get; set; }
        public StokGroup StokGroup { get; set; }
        public List<StokCardAdditionalFeatureValue> StokCardAdditionalFeatureValues { get; set; }
}

public class StokCardAdditionalFeatureValue:BaseModel
{
        public int StokKartId { get; set; }
        public StokCard StokCard { get; set; }
        public int GroupFeatureId { get; set; }
        public GroupFeature GroupFeature { get; set; }
        public string FeatureValue { get; set; }
}

Starting from StokCardAdditionalFeatureValue we have at least two cascade paths:

Through GroupFeater property and then we have reference to StokGroup

Through StokCard and then through StokGroup

You need to verify and clean up your database design to not cause such cycles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM