-
Notifications
You must be signed in to change notification settings - Fork 934
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
Fix stateless batcher #2755
Fix stateless batcher #2755
Conversation
@@ -351,7 +363,7 @@ public override bool IsOpen | |||
|
|||
public override FlushMode FlushMode | |||
{ | |||
get { return FlushMode.Commit; } | |||
get { return FlushMode.Always; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more consistent with the stateless semantic of a stateless session, and also with:
public FlushMode InitialSessionFlushMode => FlushMode.Always; |
(That is in the stateless session builder.)
Need to restrict tests to the providers that support distributed transactions. |
a8af1fe
to
a1162cf
Compare
I have amended the "more test" commit and rebased. |
{ | ||
session.Insert(entity); | ||
} | ||
session.FlushBatcher(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatelessSession
has ManagedFlush
method which is not exposed through interface. Maybe we should expose it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I choosed FlushBatcher
rather than just Flush
because in principle the stateless session should never need a Flush
, since it is stateless. So I want to stress what this flush is for: flushing the batcher that can be enabled with the stateless session, and which may retain some operations not yet sent to the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to clarify that I'm not talking about the general Flush
method, but about ManagedFlush
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of the stateless session, that is the same.
But anyway, what does it mean, ManagedFlush
? I do not make any sense of it. FlushBatcher
is explicit about its purpose, while that is not the case of ManagedFlush
in my opinion.
nhibernate-core/src/NHibernate/Impl/StatelessSessionImpl.cs
Lines 385 to 396 in 2bd3c16
public override void Flush() | |
{ | |
ManagedFlush(); // NH Different behavior since ADOContext.Context is not implemented | |
} | |
public void ManagedFlush() | |
{ | |
using (BeginProcess()) | |
{ | |
Batcher.ExecuteBatch(); | |
} | |
} |
Fix #2750.