public void SetProperty(TEntity entity, string propertyName)
 {
     using (var context = new NorthwindContext())
     {
         var entry = context.Entry(entity);
         entry.State = EntityState.Unchanged;
         entry.Property(propertyName).IsModified = true;
         context.SaveChanges();
     }
 }
 public void UpdateExcludingProperties(TEntity entity, int id, IEnumerable <string> propertiesToExclude = null)
 {
     using (var context = new NorthwindContext())
     {
         var entry = context.Entry(entity);
         entry.State = EntityState.Modified;
         ExcludeSomeProperties(propertiesToExclude, entry);
         context.SaveChanges();
     }
 }