public string ToQuery() { var builder = new StringBuilder(); builder.Append("select "); var fields = string.Join(", ", Fields.Select(field => $"[{field}]").ToArray()); builder.Append(fields); builder.Append(" from "); builder.Append(Mode == QueryMode.Default ? "WorkItems" : "WorkItemLinks"); var whereStringStatements = WhereStatements.Select(statement => $" where {statement.ConvertToQueryValue()} "); foreach (var st in whereStringStatements) { builder.Append(st); } if (OrderStatements.Count > 0) { builder.Append(" order by "); var orders = OrderStatements.Select(ost => ost.ConvertToQueryValue()).ToArray(); builder.Append(string.Join(", ", orders.ToArray())); } return(null); }
public WhereStatementRelation(WhereStatement left, WhereStatementRelation right, StatementRelationOperator relationOperator) { RelationOperator = relationOperator; WhereStatements.Add(left); WhereStatementRelations.Add(right); }