Skip to content

Remove no longer used code in QueryModelVisitor #2582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/NHibernate/Linq/Clauses/NhJoinClause.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public NhJoinClause(string itemName, System.Type itemType, Expression fromExpres

public bool IsInner { get; private set; }

internal JoinClause ParentJoinClause { get; set; }

public void TransformExpressions(Func<Expression, Expression> transformation)
{
if (transformation == null) throw new ArgumentNullException(nameof(transformation));
Expand Down
25 changes: 4 additions & 21 deletions src/NHibernate/Linq/Visitors/QueryModelVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,27 +576,10 @@ private void AddJoin(JoinClause joinClause, QueryModel queryModel, bool innerJoi
var withClause = equalityVisitor.Visit(joinClause.InnerKeySelector, joinClause.OuterKeySelector);
var alias = _hqlTree.TreeBuilder.Alias(VisitorParameters.QuerySourceNamer.GetName(joinClause));
var joinExpression = HqlGeneratorExpressionVisitor.Visit(joinClause.InnerSequence, VisitorParameters);
HqlTreeNode join;
// When associations are located inside the inner key selector we have to use a cross join instead of an inner
// join and add the condition in the where statement.
if (queryModel.BodyClauses.OfType<NhJoinClause>().Any(o => o.ParentJoinClause == joinClause))
{
if (!innerJoin)
{
throw new NotSupportedException("Left joins that have association properties in the inner key selector are not supported.");
}

_hqlTree.AddWhereClause(withClause);
join = CreateCrossJoin(joinExpression, alias);
}
else
{
join = innerJoin
? _hqlTree.TreeBuilder.InnerJoin(joinExpression.AsExpression(), alias)
: (HqlTreeNode) _hqlTree.TreeBuilder.LeftJoin(joinExpression.AsExpression(), alias);
join.AddChild(_hqlTree.TreeBuilder.With(withClause));
}

var join = innerJoin
? _hqlTree.TreeBuilder.InnerJoin(joinExpression.AsExpression(), alias)
: (HqlTreeNode) _hqlTree.TreeBuilder.LeftJoin(joinExpression.AsExpression(), alias);
join.AddChild(_hqlTree.TreeBuilder.With(withClause));
_hqlTree.AddFromClause(join);
}

Expand Down