@@ -22,6 +22,7 @@ public class AddJoinsReWriter : NhQueryModelVisitorBase, IIsEntityDecider, INhQu
22
22
private readonly MemberExpressionJoinDetector _memberExpressionJoinDetector ;
23
23
private readonly WhereJoinDetector _whereJoinDetector ;
24
24
private JoinClause _currentJoin ;
25
+ private bool ? _innerJoin ;
25
26
26
27
private AddJoinsReWriter ( ISessionFactoryImplementor sessionFactory , QueryModel queryModel )
27
28
{
@@ -64,10 +65,15 @@ public override void VisitNhHavingClause(NhHavingClause havingClause, QueryModel
64
65
65
66
public void VisitNhOuterJoinClause ( NhOuterJoinClause nhOuterJoinClause , QueryModel queryModel , int index )
66
67
{
67
- VisitJoinClause ( nhOuterJoinClause . JoinClause , queryModel , nhOuterJoinClause ) ;
68
+ VisitJoinClause ( nhOuterJoinClause . JoinClause , false ) ;
68
69
}
69
70
70
71
public override void VisitJoinClause ( JoinClause joinClause , QueryModel queryModel , int index )
72
+ {
73
+ VisitJoinClause ( joinClause , true ) ;
74
+ }
75
+
76
+ private void VisitJoinClause ( JoinClause joinClause , bool innerJoin )
71
77
{
72
78
joinClause . InnerSequence = _whereJoinDetector . Transform ( joinClause . InnerSequence ) ;
73
79
@@ -79,8 +85,10 @@ public override void VisitJoinClause(JoinClause joinClause, QueryModel queryMode
79
85
// support them).
80
86
// Link newly created joins with the current join clause in order to later detect which join type to use.
81
87
_currentJoin = joinClause ;
88
+ _innerJoin = innerJoin ;
82
89
joinClause . InnerKeySelector = _whereJoinDetector . Transform ( joinClause . InnerKeySelector ) ;
83
90
_currentJoin = null ;
91
+ _innerJoin = null ;
84
92
}
85
93
86
94
public bool IsEntity ( System . Type type )
@@ -97,7 +105,7 @@ public bool IsIdentifier(System.Type type, string propertyName)
97
105
private void AddJoin ( QueryModel queryModel , NhJoinClause joinClause )
98
106
{
99
107
joinClause . ParentJoinClause = _currentJoin ;
100
- if ( _currentJoin != null )
108
+ if ( _innerJoin == true )
101
109
{
102
110
// Match the parent join type
103
111
joinClause . MakeInner ( ) ;
0 commit comments