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);
}
}
}