实体框架核心-可能导致循环或多个级联路径错误

时间:2019-06-15 22:25:20

标签: c# entity-framework-core-2.2

我正在创建一些模型,并且在配置流畅的API和添加迁移时出现此错误。我不明白为什么在设置DeleteBehaviour.Restrict时会告诉我这一点?

Hello

fluet api

public class Registo
{
    public int CelulaId { get; set; }
    public Celula Celula { get; set; }

    public int ReferenciaId { get; set; }
    public Referencia Referencia { get; set; }

    public ICollection<ComponenteArranque> Componentes { get; set; }
    public ICollection<RegistoGeometria> RegistosGeometria { get; set; }
}

[Table("hGeometrias")]
public class Geometria
{
    public int Id { get; set; }
    public string Referencia { get; set; }
    public int MatrizCelulaReferenciaId { get; set; }
    public MatrizCelulaReferencia Matriz { get; set; }

    public ICollection<RegistoGeometria> RegistosGeometria { get; set; }
}

[Table("hRegistosGeomtrias")]
public class RegistoGeometria
{
    public int Id { get; set; }

    public float X1 { get; set; }
    public float X2 { get; set; }
    public float X3 { get; set; }
    public float X4 { get; set; }

    public int RegistoId { get; set; }
    public Registo Registo { get; set; }

    public int GeometriaId { get; set; }
    public Geometria Geometria { get; set; }
}
  

介绍FOREIGN KEY约束   表格上的'FK_hRegistosGeomtrias_hRegistos_RegistoId'   “ hRegistosGeomtrias”可能会导致循环或多个级联路径。   指定ON DELETE NO ACTION或ON UPDATE NO ACTION,或修改其他   外键约束。无法创建约束或索引。看到   以前的错误。

0 个答案:

没有答案