Attach entity in modified state without marking all properties dirty
问题 I'm trying to figure out how to mark specific properties of a detached entity as modified. If I do the following, it will mark all properties modified and the generated sql will update all columns. /// <summary> /// Sets the entity in the modified state. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity">The entity.</param> void IDbContext.Modified<T>(T entity) { DbEntityEntry<T> entry = Entry(entity); if (entry.State == EntityState.Modified) { // if the state is