public string AsSqlString() { var update = _changes.Aggregate("", (acc, change) => acc == "" ? $"{change.Attribute.DataBaseColumn} = @{change.Attribute.DataBaseColumn}0" : acc + $", {change.Attribute.DataBaseColumn} = @{change.Attribute.DataBaseColumn}0"); var table = $"UPDATE {Entity.TableName} "; var set = $"SET {update}"; var returningAttrs = _returningAttributes.Aggregate("", (acc, attr) => acc == "" ? attr.DataBaseColumn : acc + ", " + attr.DataBaseColumn); var returning = $"RETURNING {returningAttrs}"; var where = $"WHERE {_whereClause.AsSqlString()}"; return($"{table} " + $"{set}" + $" {where}" + $" {returning}"); }
public string AsSqlString() { var del = $"DELETE FROM {Entity.TableName} "; return($"{del} WHERE {_where.AsSqlString()}"); }