internal void InitialDerivedTableJoin(string rightField, string rightTable, QBuilder derivedTable, string derivedFieldName, string joinType) { var derivedTableJoinDescription = new DerivedTableJoinDescription { RightField = rightField, RightTable = rightTable, LeftField = derivedFieldName, QBuilder = derivedTable, JoinType = joinType, }; JoinedDerivedTables.Add(derivedTable.DerivedTableName); TranslateToJoinDescription(derivedTableJoinDescription); }
internal JoinBuilder JoinDerivedTable <TRightTable, TRightField>(Expression <Func <TRightTable, TRightField> > rightFieldNameDescriptor, QBuilder derivedTable, string derivedFieldName, string joinType) { var alreadyUsedDerivedTableInPreviousJoin = JoinedDerivedTables.FirstOrDefault(a => a.Equals(derivedTable.DerivedTableName, StringComparison.InvariantCultureIgnoreCase)) != null; var rightField = _fieldNameResolver.GetFieldName(rightFieldNameDescriptor); var rightTable = QBuilder.TableNameResolver(typeof(TRightTable)); if (alreadyUsedDerivedTableInPreviousJoin) { SecondaryDerivedTableJoin(rightField, rightTable, derivedTable, derivedFieldName, joinType); } else { InitialDerivedTableJoin(rightField, rightTable, derivedTable, derivedFieldName, joinType); } return(this); }