/// <summary> /// /// </summary> /// <param name="from"></param> /// <returns></returns> private List <FromAlias> GetAliasList(FromClause from) { var joinCount = 0; var node = from; while (node.Parent != null) { node = node.Parent; ++joinCount; } var list = new List <FromAlias>(); node = from; while (node != null) { var alias = "T" + (joinCount - list.Count); var fa = new FromAlias() { FromClause = node, TableType = node.TableType, Name = alias }; if (node.SubSelect != null) { fa.SubGeneratedSelect = GetModel(node.SubSelect); } list.Add(fa); node = node.Parent; } list.Reverse(); return(list); }
/// <summary> /// Gets the alias list. /// </summary> /// <returns>The alias list.</returns> /// <param name="from">From.</param> /// <param name="subQueryHandler">Sub query handler.</param> public static List <FromAlias> GetAliasList(FromClause from, Func <SelectStatement, SelectStatementModel> subQueryHandler = null) { var joinCount = 0; var node = from; while (node.Parent != null) { node = node.Parent; ++joinCount; } var list = new List <FromAlias>(); node = from; while (node != null) { var alias = "T" + (joinCount - list.Count); var fa = new FromAlias() { FromClause = node, TableType = node.TableType, Name = alias }; if (node.SubSelect != null && subQueryHandler != null) { fa.SubGeneratedSelect = subQueryHandler(node.SubSelect); } list.Add(fa); node = node.Parent; } list.Reverse(); return(list); }