다 - 대 - 다 관련 엔티티를 저장할 때 엔티티가 저장됩니다. 그러나 접합 테이블이 비어 유지 : 제품 측면에fluentnhibernate ManyToMany가 접합 테이블에 레코드를 추가하지 않음
매핑 (ProductMap.cs)
HasManyToMany(x => x.Pictures)
.Table("Product_Picture")
.ParentKeyColumn("Product")
.ChildKeyColumn("Picture")
.Cascade.All()
.Inverse()
이 다음 XML 생성 : 그림 측
<bag cascade="all" name="Pictures" table="Product_Picture">
<key>
<column name="Product" />
</key>
<many-to-many class="...Picture...">
<column name="Picture" />
</many-to-many>
</bag>
매핑 (PictureMap.cs를)
HasManyToMany(x => x.Products)
.Table("Product_Picture")
.ParentKeyColumn("Picture")
.ChildKeyColumn("Product")
.Cascade.All();
그러면 다음 xml이 생성됩니다.
<bag inverse="true" cascade="all" name="Products" table="Product_Picture">
<key>
<column name="Picture" />
</key>
<many-to-many class="...Product...">
<column name="Product" />
</many-to-many>
</bag>
아이디어가 있으십니까?
코드 블록을 시작하기 전에 빈 줄이 필요합니다. –
ok thanks :) 이제는 질문에 대한 답변 만 필요합니다. – Bertvan
제안한 것처럼 더 많은 코드를 볼 필요가 있습니다 ... –