Skip to content

Commit 84c5463

Browse files
committed
Fix after cherry-pick
1 parent 1c72730 commit 84c5463

File tree

6 files changed

+49
-18
lines changed

6 files changed

+49
-18
lines changed

src/NHibernate/Linq/Clauses/INhQueryModelVisitor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ namespace NHibernate.Linq.Clauses
55
public interface INhQueryModelVisitor: IQueryModelVisitor
66
{
77
void VisitNhJoinClause(NhJoinClause nhJoinClause, QueryModel queryModel, int index);
8-
void VisitNhWhereClause(NhWhereClause nhWhereClause, QueryModel queryModel, int index);
8+
9+
void VisitNhWithClause(NhWithClause nhWhereClause, QueryModel queryModel, int index);
10+
11+
void VisitNhHavingClause(NhHavingClause nhWhereClause, QueryModel queryModel, int index);
912
}
1013
}

src/NHibernate/Linq/Clauses/NhHavingClause.cs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace NHibernate.Linq.Clauses
88
{
9-
public class NhHavingClause : NhWhereClause
9+
public class NhHavingClause : NhWhereClause, IBodyClause, IClause
1010
{
1111
public NhHavingClause(Expression predicate)
1212
: base(predicate)
@@ -17,9 +17,27 @@ public override string ToString()
1717
{
1818
return "having " + Predicate;
1919
}
20+
21+
/// <summary>
22+
/// Accepts the specified visitor by calling its <see cref="M:Remotion.Linq.IQueryModelVisitor.VisitWhereClause(Remotion.Linq.Clauses.WhereClause,Remotion.Linq.QueryModel,System.Int32)" /> method.
23+
/// </summary>
24+
/// <param name="visitor">The visitor to accept.</param>
25+
/// <param name="queryModel">The query model in whose context this clause is visited.</param>
26+
/// <param name="index">The index of this clause in the <paramref name="queryModel" />'s <see cref="P:Remotion.Linq.QueryModel.BodyClauses" /> collection.</param>
27+
public override void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index)
28+
{
29+
if (visitor == null) throw new ArgumentNullException(nameof(visitor));
30+
if (queryModel == null) throw new ArgumentNullException(nameof(queryModel));
31+
((INhQueryModelVisitor) visitor).VisitNhHavingClause(this, queryModel, index);
32+
}
33+
34+
IBodyClause IBodyClause.Clone(CloneContext cloneContext)
35+
{
36+
return Clone(cloneContext);
37+
}
2038
}
2139

22-
public class NhWhereClause : IBodyClause, IClause
40+
public abstract class NhWhereClause
2341
{
2442
private Expression _predicate;
2543

@@ -55,12 +73,7 @@ public NhWhereClause(Expression predicate)
5573
/// <param name="visitor">The visitor to accept.</param>
5674
/// <param name="queryModel">The query model in whose context this clause is visited.</param>
5775
/// <param name="index">The index of this clause in the <paramref name="queryModel" />'s <see cref="P:Remotion.Linq.QueryModel.BodyClauses" /> collection.</param>
58-
public void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index)
59-
{
60-
if (visitor == null) throw new ArgumentNullException(nameof(visitor));
61-
if (queryModel == null) throw new ArgumentNullException(nameof(queryModel));
62-
((INhQueryModelVisitor)visitor).VisitNhWhereClause(this, queryModel, index);
63-
}
76+
public abstract void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index);
6477

6578
/// <summary>
6679
/// Transforms all the expressions in this clause and its child objects via the given <paramref name="transformation" /> delegate.
@@ -82,11 +95,6 @@ public WhereClause Clone(CloneContext cloneContext)
8295
return new WhereClause(Predicate);
8396
}
8497

85-
IBodyClause IBodyClause.Clone(CloneContext cloneContext)
86-
{
87-
return Clone(cloneContext);
88-
}
89-
9098
public override string ToString()
9199
{
92100
return "where " + Predicate;

src/NHibernate/Linq/Clauses/NhWithClause.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
using System;
12
using System.Linq.Expressions;
3+
using Remotion.Linq;
24
using Remotion.Linq.Clauses;
35
using Remotion.Linq.Clauses.ExpressionVisitors;
46

57
namespace NHibernate.Linq.Clauses
68
{
7-
public class NhWithClause : NhWhereClause
9+
public class NhWithClause : NhWhereClause, IBodyClause, IClause
810
{
911
public NhWithClause(Expression predicate)
1012
: base(predicate)
@@ -15,5 +17,23 @@ public override string ToString()
1517
{
1618
return "with " + Predicate;
1719
}
20+
21+
/// <summary>
22+
/// Accepts the specified visitor by calling its <see cref="M:Remotion.Linq.IQueryModelVisitor.VisitWhereClause(Remotion.Linq.Clauses.WhereClause,Remotion.Linq.QueryModel,System.Int32)" /> method.
23+
/// </summary>
24+
/// <param name="visitor">The visitor to accept.</param>
25+
/// <param name="queryModel">The query model in whose context this clause is visited.</param>
26+
/// <param name="index">The index of this clause in the <paramref name="queryModel" />'s <see cref="P:Remotion.Linq.QueryModel.BodyClauses" /> collection.</param>
27+
public override void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index)
28+
{
29+
if (visitor == null) throw new ArgumentNullException(nameof(visitor));
30+
if (queryModel == null) throw new ArgumentNullException(nameof(queryModel));
31+
((INhQueryModelVisitor)visitor).VisitNhWithClause(this, queryModel, index);
32+
}
33+
34+
IBodyClause IBodyClause.Clone(CloneContext cloneContext)
35+
{
36+
return Clone(cloneContext);
37+
}
1838
}
1939
}

src/NHibernate/Linq/Visitors/NhQueryModelVisitorBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ public virtual void VisitNhJoinClause(NhJoinClause joinClause, QueryModel queryM
1313
{
1414
}
1515

16-
public virtual void VisitNhWithClause(NhWithClause withClause, QueryModel queryModel, int index)
16+
public virtual void VisitNhWithClause(NhWithClause nhWhereClause, QueryModel queryModel, int index)
1717
{
18+
1819
}
1920
}
2021
}

src/NHibernate/Linq/Visitors/QueryModelVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public override void VisitNhHavingClause(NhHavingClause havingClause, QueryModel
309309
_hqlTree.AddHavingClause(expression);
310310
}
311311

312-
public override void VisitNhWithClause(NhWithClause withClause, QueryModel queryModel, int index)
312+
public virtual void VisitNhWithClause(NhWithClause withClause, QueryModel queryModel, int index)
313313
{
314314
var visitor = new SimplifyConditionalVisitor();
315315
withClause.Predicate = visitor.Visit(withClause.Predicate);

src/NHibernate/NHibernate.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@
303303
<Compile Include="ITransaction.cs" />
304304
<Compile Include="LazyInitializationException.cs" />
305305
<Compile Include="Linq\Visitors\NhQueryModelVisitorBase.cs" />
306-
<Compile Include="Linq\Visitors\INhQueryModelVisitor.cs" />
307306
<Compile Include="Linq\Clauses\NhHavingClause.cs" />
308307
<Compile Include="Linq\Clauses\NhJoinClause.cs" />
309308
<Compile Include="Linq\Clauses\NhWithClause.cs" />

0 commit comments

Comments
 (0)