protected ExpressionListToQuery ( |
||
queryToAddTo | Query we're adding the expression to. | |
boolType | BooleanOperator | Whether to AND or OR the expressions together. |
expressions | IEnumerable |
The expressions to add to the query. |
mapping | ClassMapping | Class mapping for the class we're dealing with. |
colPrefix | string | What to prefix column names with, I.E. "Table." for "Table.Column". /// May be null if no prefix is desired. May be something other than /// the table name if the tables are being aliased. |
return | void |
protected void ExpressionListToQuery(SqlDaQuery queryToAddTo,
BooleanOperator boolType,
IEnumerable<IExpression> expressions,
ClassMapping mapping, string colPrefix)
{
// starts out false for the first one.
bool needsBooleanOperator = false;
string boolText = BoolTypeToString(boolType);
foreach (IExpression expr in expressions)
{
try
{
if (expr == null)
{
throw new NullReferenceException("Can't convert a null expression to SQL.");
}
// After the first guy writes something, we need an operator.
if (ExpressionToQuery(queryToAddTo, expr, mapping, colPrefix,
needsBooleanOperator ? boolText : ""))
{
needsBooleanOperator = true;
}
}
catch (Exception e)
{
throw new UnableToConstructSqlException("Unable to add expression to query: " + expr, _connDesc, e);
}
}
}