Adding columns and conditions with code

Here we suppose that our Query object is referenced as query

private void AddColumnsConditionsByCode() {
 
    query.Clear();
    //add a simple column
    query.AddSimpleColumn("Customers.CompanyName", "Customer");
    query.AddSimpleColumn("Orders.OrderDate", "Order date");

    //add an aggregate column
    var attr = query.Model.FindEntityAttr("Orders.Freight");
    var expr = query.CreateAggrFuncExpr("SUM", query.CreateEntityAttrExpr(attr));
    var col = query.CreateColumn();
    col.Caption = "Total";
    col.Expr = expr;
    query.Columns.Add(col);

    //add a simple condition
    query.Root.AddSimpleCondition("Customers.Country", "Equals", "USA");

    //here is one more example: how to add a group of conditions
    var group = query.AddConditionGroup(Condition.LinkType.Any);
    group.AddSimpleCondition("Customers.City", "Equal", "London");
    group.AddSimpleCondition("Customer.City", "Equal", "NewYork");
 
    //generate SQL statement
    SqlQueryBuilder builder = new SqlQueryBuilder(query);
    builder.BuildSQL();
    string sql = builder.Result.SQL;
}