Figured out a solution:
Code:
Sub CheckModifiedValues(ByVal Context As ObjectContext)
Try
'Get all objects modified
Dim Changes As IEnumerable(Of ObjectStateEntry) = Context.ObjectStateManager.GetObjectStateEntries(EntityState.Modified)
If Changes.Count > 0 Then
'Loop through changed objects
For Each Obj In Changes
'get the properties modified for the object
Dim ModifiedProperties As IEnumerable(Of String) = Obj.GetModifiedProperties
If ModifiedProperties.Count > 0 Then
For Each prop As String In ModifiedProperties
'these will error if you pass through a property that was not modified - thus the GetModifiedProperties
Dim strOrg As String = Obj.OriginalValues(prop).ToString
Dim strMod As String = Obj.CurrentValues(prop).ToString
MessageBox.Show("Current " & prop & ": " & strMod & " Original " & prop & ": " & strOrg)
Next
End If
Next
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Bookmarks