private SqlFormatter(QueryLanguage language, bool forDebug)
 {
     this.language = language;
     this.sb = new StringBuilder();
     this.aliases = new Dictionary<TableAlias, string>();
     this.forDebug = forDebug;
 }
 private QueryBinder(QueryMapper mapper, Expression root)
 {
     this.mapper = mapper;
     this.language = mapper.Translator.Linguist.Language;
     this.map = new Dictionary<ParameterExpression, Expression>();
     this.groupByMap = new Dictionary<Expression, GroupByInfo>();
     this.root = root;
 }
 private ColumnProjector(QueryLanguage language, Expression expression, IEnumerable<ColumnDeclaration> existingColumns, TableAlias newAlias, IEnumerable<TableAlias> existingAliases)
 {
     this.language = language;
     this.newAlias = newAlias;
     this.existingAliases = new HashSet<TableAlias>(existingAliases);
     this.map = new Dictionary<ColumnExpression, ColumnExpression>();
     if (existingColumns != null)
     {
         this.columns = new List<ColumnDeclaration>(existingColumns);
         this.columnNames = new HashSet<string>(existingColumns.Select(c => c.Name));
     }
     else
     {
         this.columns = new List<ColumnDeclaration>();
         this.columnNames = new HashSet<string>();
     }
     this.candidates = Nominator.Nominate(language, expression);
 }
 internal static HashSet<Expression> Nominate(QueryLanguage language, Expression expression)
 {
     Nominator nominator = new Nominator(language);
     nominator.Visit(expression);
     return nominator.candidates;
 }
 public static string Format(Expression expression, QueryLanguage language)
 {
     TSqlFormatter formatter = new TSqlFormatter(language);
     formatter.Visit(expression);
     return formatter.ToString();
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return new OrderByRewriter(language).Visit(expression);
 }
 public QueryTranslator(QueryLanguage language, QueryMapping mapping, QueryPolicy policy)
 {
     this.linguist = language.CreateLinguist(this);
     this.mapper = mapping.CreateMapper(this);
     this.police = policy.CreatePolice(this);
 }
 private SkipToNestedOrderByRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 public static Expression Rewrite(QueryPolicy policy, QueryLanguage language, Expression expression)
 {
     return new ClientJoinedProjectionRewriter(policy, language).Visit(expression);
 }
 private SkipToRowNumberRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 private SingletonProjectionRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 protected TSqlFormatter(QueryLanguage language)
     : base(language)
 {
 }
 public static ProjectedColumns ProjectColumns(QueryLanguage language, Expression expression, IEnumerable<ColumnDeclaration> existingColumns, TableAlias newAlias, IEnumerable<TableAlias> existingAliases)
 {
     ColumnProjector projector = new ColumnProjector(language, expression, existingColumns, newAlias, existingAliases);
     Expression expr = projector.Visit(expression);
     return new ProjectedColumns(expr, projector.columns.AsReadOnly());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlFormatter"/> class.
 /// </summary>
 /// <param name="language">The language.</param>
 protected SqlFormatter(QueryLanguage language)
     : this(language, false)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OleDbQueryProvider"/> class.
 /// </summary>
 /// <param name="connection">The connection.</param>
 /// <param name="language">The language.</param>
 /// <param name="mapping">The mapping.</param>
 /// <param name="policy">The policy.</param>
 public OleDbQueryProvider(OleDbConnection connection, QueryLanguage language, QueryMapping mapping, QueryPolicy policy)
     : base(connection, language, mapping, policy)
 {
 }
 private SQLiteFormatter(QueryLanguage language)
     : base(language)
 {
 }
 /// <summary>
 /// 实例化新的一个 <see cref="QueryLinguist"/> 类对象。
 /// </summary>
 /// <param name="language">The language.</param>
 /// <param name="translator">The translator.</param>
 public QueryLinguist(QueryLanguage language, QueryTranslator translator)
 {
     this.language = language;
     this.translator = translator;
 }
 private AccessFormatter(QueryLanguage language)
     : base(language)
 {
 }
 public static ProjectedColumns ProjectColumns(QueryLanguage language, Expression expression, IEnumerable<ColumnDeclaration> existingColumns, TableAlias newAlias, params TableAlias[] existingAliases)
 {
     return ProjectColumns(language, expression, existingColumns, newAlias, (IEnumerable<TableAlias>)existingAliases);
 }
 private RelationshipBinder(QueryMapper mapper)
 {
     this.mapper = mapper;
     this.mapping = mapper.Mapping;
     this.language = mapper.Translator.Linguist.Language;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return new SkipToRowNumberRewriter(language).Visit(expression);
 }
 private CrossApplyRewriter(QueryLanguage language)
 {
     this.language = language;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expression)
 {
     return new SingletonProjectionRewriter(language).Visit(expression);
 }
 protected DbExpressionWriter(TextWriter writer, QueryLanguage language)
     : base(writer)
 {
     this.language = language;
 }
 private ClientJoinedProjectionRewriter(QueryPolicy policy, QueryLanguage language)
 {
     this.policy = policy;
     this.language = language;
 }
 public static void Write(TextWriter writer, QueryLanguage language, Expression expression)
 {
     new DbExpressionWriter(writer, language).Visit(expression);
 }
 private OrderByRewriter(QueryLanguage language)
 {
     this.language = language;
     this.isOuterMostSelect = true;
 }
 public static string WriteToString(QueryLanguage language, Expression expression)
 {
     StringWriter sw = new StringWriter();
     Write(sw, language, expression);
     return sw.ToString();
 }
 private Nominator(QueryLanguage language)
 {
     this.language = language;
     this.candidates = new HashSet<Expression>();
     this.isBlocked = false;
 }
 public static Expression Rewrite(QueryLanguage language, Expression expr)
 {
     return new AggregateRewriter(language, expr).Visit(expr);
 }