public static FromExpressionInfo AnalyzeFromExpression (
Expression fromExpression,
ISqlPreparationStage stage,
UniqueIdentifierGenerator generator,
IMethodCallTransformerProvider provider,
ISqlPreparationContext context,
Func<ITableInfo, SqlTable> tableGenerator)
{
ArgumentUtility.CheckNotNull ("fromExpression", fromExpression);
ArgumentUtility.CheckNotNull ("stage", stage);
ArgumentUtility.CheckNotNull ("generator", generator);
ArgumentUtility.CheckNotNull ("provider", provider);
ArgumentUtility.CheckNotNull ("context", context);
var visitor = new SqlPreparationFromExpressionVisitor (generator, stage, provider, context, tableGenerator);
visitor.VisitExpression (fromExpression);
if (visitor.FromExpressionInfo != null)
return visitor.FromExpressionInfo.Value;
var message = string.Format (
"Error parsing expression '{0}'. Expressions of type '{1}' cannot be used as the SqlTables of a from clause.",
FormattingExpressionTreeVisitor.Format (fromExpression),
fromExpression.Type.Name);
throw new NotSupportedException (message);
}