public virtual SqlStatement BuildCrudUpdateOne(DbTableInfo table, EntityRecord rec) { var placeHolders = new SqlPlaceHolderList(); // find modified columns var setExprs = new List <SqlFragment>(); foreach (var col in table.UpdatableColumns) { if (!rec.IsValueChanged(col.Member)) { continue; } var valueSql = new SqlColumnValuePlaceHolder(col); placeHolders.Add(valueSql); setExprs.Add(new CompositeSqlFragment(col.SqlColumnNameQuoted, SqlTerms.Equal, valueSql)); } var setList = SqlFragment.CreateList(SqlTerms.Comma, setExprs); var whereCond = BuildWhereConditonForUpdateDeleteOne(table, placeHolders); var whereClause = new CompositeSqlFragment(SqlTerms.Where, whereCond); var sql = SqlDialect.SqlCrudTemplateUpdate.Format(table.SqlFullName, setList, whereClause); var stmt = new SqlStatement(SqlKind.UpdateOne, sql, placeHolders, DbExecutionType.NonQuery, SqlDialect.PrecedenceHandler, QueryOptions.NoQueryCache); return(stmt); }