protected internal override TEntity UpdateEntity(TKey key, TEntity update) { TEntity original = DbSet.Find(key); if (original == null) { string error = string.Format("Entity lookup failed for key {0} in {1}", key, DbSet); throw new ArgumentException(error, "key"); } // Apply changes ReflectionExtensions.CopyPublicPrimitivePropertyValues(update, original); this.OnChangeSetSuccess(SaveChanges); return(original); }