internal static void UpdateOnlySql <T>(this IDbCommand dbCmd, T model, SqlExpression <T> onlyFields) { OrmLiteConfig.UpdateFilter?.Invoke(dbCmd, model); var fieldsToUpdate = onlyFields.UpdateFields.Count == 0 ? onlyFields.GetAllFields() : onlyFields.UpdateFields; onlyFields.CopyParamsTo(dbCmd); dbCmd.GetDialectProvider().PrepareUpdateRowStatement(dbCmd, model, fieldsToUpdate); if (!onlyFields.WhereExpression.IsNullOrEmpty()) { dbCmd.CommandText += $" {onlyFields.WhereExpression}"; } }
internal static string UpdateOnlySql <T>(this IDbCommand dbCmd, T model, SqlExpression <T> onlyFields) { if (OrmLiteConfig.UpdateFilter != null) { OrmLiteConfig.UpdateFilter(dbCmd, model); } var fieldsToUpdate = onlyFields.UpdateFields.Count == 0 ? onlyFields.GetAllFields() : onlyFields.UpdateFields; var sql = dbCmd.GetDialectProvider().ToUpdateRowStatement(model, fieldsToUpdate); if (!onlyFields.WhereExpression.IsNullOrEmpty()) { sql += " " + onlyFields.WhereExpression; } return(sql); }
public IList <string> GetAllFields() { return(q.GetAllFields()); }