0
는
나는 업데이트가 엔티티의 하나에 이루어질 때 하위 context_SaviningChanges이 실행하도록하는 핸들러과 같이 객체있다 :이 엔티티는 SavingChanges에 업데이트되는 확인 중 무엇
AddHandler Me.SavingChanges, AddressOf context_SavingChanges
내가 특정 코드를 갖고 싶어 갱신중인 각 엔티티에 대해 실행됩니다. 그래서, 그것이 "전화"엔티티라면, 나는 하나의 코드를 트리거하려고하지만, 그것이 "건물"엔티티라면 나는 다른 코드를 트리거하려고합니다.
For Each entry as ObjectStateEntry in DirectCast(sender, ObjectContext).ObjectStateManager.GetObjectStateEntries(EntityState.Modified)
If entry.entity("phone") Then
... code goes here for phone changes ...
ElseIf entry.entity("building")
... code goes here for building changes ...
Else
... code goes here for other entity changes ...
Next
및 질문은? – jeroenh
당신은 entry.entity ("phone")을 할 수 없습니다. 그래서 현재 편집 된 엔티티를 올바르게 검사하는 방법을 알아야합니다. 그래서 특정 엔티티에 적절한 코드를 설정할 수 있습니다. – davemackey