0
나는 이렇게 추천 테이블이 있습니다EF 유창함 API와 어려움을 겪고
public class Table1
{
public int Id {get;set;}
public string Name {get;set;}
}
public class Table2
{
public int Id {get;set;}
public string Name {get;set;}
public int Table1Id {get;set;}
public virtual Table1 {get; set;}
}
public class Table3
{
public int Id {get;set;}
public string Name {get;set;}
public int Table2Id {get;set;}
public virtual Table2 {get; set;}
}
public class Table4
{
public int Id {get;set;}
public string Name {get;set;}
public int Table3Id {get;set;}
public virtual Table3 {get; set;}
}
을 그리고 내 유창 API 따라서 같다 :
modelBuilder.Entity<Table2>().HasRequired(x => x.Table1).WithMany().WillCascadeOnDelete(false);
modelBuilder.Entity<Table3>().HasRequired(x => x.Table2).WithMany().WillCascadeOnDelete(false);
modelBuilder.Entity<Table4>().HasRequired(x => x.Table3).WithMany().WillCascadeOnDelete(false);
나는 테이블을 씨앗을 시도, 내가 얻을 이 오류 :. 외래 키 제약 "FK_Table4_Table3_Table3Id 와 충돌
INSERT 문은 충돌 데이터베이스 MYDB 탭에서 발생 le "dbo.Table3", 컬럼 'Id'. 명령문이 종료되었습니다. "
내가
"* * 테이블을 시드하려고 할 때"코드를 표시 할 수 있습니까? – Slauma