Update some properties

public virtual void UpdateByProperties<TEntity>(TEntity entity, params Expression<Func<TEntity, object>>[] properties) where TEntity : class
{
var entry = this.Entry(entity);
foreach (var selector in properties)
{
entry.Property(selector).IsModified = true;
}
SaveChanges();
}

原文地址:https://www.cnblogs.com/kevin1988/p/15036345.html