0
WCF 서비스 호출을 통해 [Performances]
과 일대 다 관계가있는 새 [Shows]
레코드를 삽입하려고합니다.Entity Framework - 여러 관련 개체가있는 개체 삽입
[Shows]
레코드가 생성되었지만 [Performances]
레코드는 생성되지 않습니다. 오류가 발생하지 않습니다. 실적 기록도 어떻게 만들 수 있습니까?
클라이언트
Dim oShow As New Show With
{
'Properties here...
}
Dim cPerformances As New Collections.ObjectModel.Collection(Of Performance)
cPerformances.Add(New Performance With
{
'Properties here...
})
cPerformances.Add(New Performance With
{
'Properties here...
})
oShow.Performances = cPerformances
Dim myServiceRef As New myWCFService.ServiceName
myServiceRef.CreateShow(oShow)
서비스
Dim ctx As New myEntities(ServiceURI)
ctx.AddToShows(oShow)
ctx.SaveChanges()
SaveChanges()를 호출하기 전에 디버거의 서비스 측면에 제대로 채워진 공연이 보입니까? –
예, 'ctx.AddToshows (oShow)'를 실행하면 모든 속성과 2 개의 실적 개체가 나타납니다. 'Show' 레코드 만 생성됩니다. – GJKH
성능 속성에서 수동으로 생성해야합니다. – OneFineDay