Skip to content

Commit beff969

Browse files
committed
Revert "Cache query plan for DML LINQ queries (#2229)"
This reverts commit 8c7444d
1 parent 1920603 commit beff969

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/NHibernate/Linq/NhLinqExpression.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,13 @@ public IASTNode Translate(ISessionFactoryImplementor sessionFactory, bool filter
8888

8989
ParameterDescriptors = requiredHqlParameters.AsReadOnly();
9090

91-
if (QueryMode == QueryMode.Select && CanCachePlan)
92-
{
93-
CanCachePlan =
94-
// If some constants do not have matching HQL parameters, their values from first query will
95-
// be embedded in the plan and reused for subsequent queries: do not cache the plan.
96-
!ParameterValuesByName
91+
CanCachePlan = CanCachePlan &&
92+
// If some constants do not have matching HQL parameters, their values from first query will
93+
// be embedded in the plan and reused for subsequent queries: do not cache the plan.
94+
!ParameterValuesByName
9795
.Keys
9896
.Except(requiredHqlParameters.Select(p => p.Name))
9997
.Any();
100-
}
10198

10299
// The ast node may be altered by caller, duplicate it for preserving the original one.
103100
return DuplicateTree(ExpressionToHqlTranslationResults.Statement.AstNode);

0 commit comments

Comments
 (0)