Advertisement
Guest User

Untitled

a guest
May 5th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Public Overrides Function SaveChanges() As Integer
  2.  
  3. Dim modifiedEntities = ChangeTracker.Entries.ToList
  4.  
  5. For Each ent As DbEntityEntry In modifiedEntities
  6. If ent.State = EntityState.Modified Then
  7. Dim type = ent.Entity.GetType.Name
  8. Dim primaryKey = GetPrimaryKeyValue(ent)
  9.  
  10. Dim jo As New JObject
  11. For Each prop In ent.OriginalValues.PropertyNames
  12. Dim originalValue = ent.OriginalValues(prop).ToString
  13. Dim currentValue = ent.CurrentValues(prop).ToString
  14. If originalValue <> currentValue Then
  15. jo.Add(New JProperty(prop, currentValue))
  16. End If
  17. Next
  18. End If
  19. Next
  20.  
  21. Return MyBase.SaveChanges()
  22.  
  23. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement