5
I have a class that will have two FK pointing to the same table, so Entity Framework returns the error:
Can cause cycles or multiple paths to cascade. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY restrictions.
[ForeignKey("TestePaiId")]
public virtual Teste TestePai { get; set; }
public int TestePaiId { get; set; }
[ForeignKey("TesteFilhoId")]
public virtual Teste TesteFilho{ get; set; }
public int TesteFilhoId{ get; set; }
I resolved using this code: modelBuilder.Conventions.Remove<Manytomanycascadedeleteconvention>(); inside Onmodelcreating.
– Zica
If removing the convention resolves, it means that if I delete the parent or child related to the table, it is ok that the table record has orphaned keys?
– Leonel Sanches da Silva