많은, 여기에 내가 나의 실체에 대한 구성을 다음 한 스키마엔티티 프레임 워크는 많은 잘못된 테이블 매핑
먼저 ContentBranch 엔티티 :
configuration.HasMany(e => e.ContentLeafs)
.WithMany(e => e.ContentBranches)
.Map(m => m.MapLeftKey("ContentLeafId").MapRightKey("ContentBranchId").ToTable("ContentBranchLeafs"));
그런 ContentLeaf 엔티티 :
configuration.HasMany(e => e.ContentBranches)
.WithMany(e => e.ContentLeafs)
.Map(e => e.MapLeftKey("ContentBranchId").MapRightKey("ContentLeafId").ToTable("ContentBranchLeafs"));
나는 다음과 같은 테스트 코드를 실행하기 위해 노력하고있어 :
theBranch.ContentLeafs.Add(theLeaf);
await contentBranchRepository.Update(theBranch);
나는 다음과 같은 예외가 얻을 수 있기 때문에 문제는 내가 추측 매핑입니다 : 외래 키를 노출하지 않는 개체를 저장하는 동안 오류가 발생
을 그들의 관계에 대한 속성. 단일 엔터티를 예외 소스로 식별 할 수 없으므로 EntityEntries 속성은 null을 반환합니다. 엔터티 형식에 외래 키 속성을 노출하면 저장 중에 예외를 쉽게 처리 할 수 있습니다. 자세한 내용은 InnerException을 참조하십시오.
내부 예외 :
잘못된 개체 이름 'dbo.ContentLeafContentBranches'.
명시 적 테이블 이름을 제공 할 때 EF에서 규칙을 사용하는 이유를 아는 사람이 있습니까? 도와주세요.
난 내 코드에서이 있고 그것은 hasMany의 (S => s.ContentLeafs) .WithMany (C => c.ContentBranches) .MAP (CS => { cs.MapLeftKey ("ContentBranchId 작업이야 "); cs.MapRightKey ("ContentLeafId "); cs.ToTable ("ContentBranchLeafs "); }); – ihisham