@@ -410,16 +410,31 @@ public bool IsClosed
410
410
public IDisposable BeginProcess ( )
411
411
{
412
412
return _processHelper . BeginProcess ( this ) ;
413
- }
414
-
415
- /// <summary>
416
- /// If not nested in a call to <c>BeginProcess</c> on this session, set its session id in context.
417
- /// </summary>
418
- /// <returns>
419
- /// If not already processing, an object to dispose for restoring the previous session id.
420
- /// Otherwise, <see langword="null" />.
421
- /// </returns>
422
- public IDisposable BeginContext ( )
413
+ }
414
+
415
+ /// <summary>
416
+ /// If not nested in another call to <c>BeginProcess</c> on this session, optionnaly check
417
+ /// and update the session status, then set its session id in context and flag it as processing.
418
+ /// </summary>
419
+ /// <param name="noCheckAndUpdate"><see langword="true" /> to initiate a processing without
420
+ /// checking and updating the session.</param>
421
+ /// <returns>
422
+ /// If not already processing, an object to dispose for signaling the end of the process.
423
+ /// Otherwise, <see langword="null" />.
424
+ /// </returns>
425
+ protected IDisposable BeginProcess ( bool noCheckAndUpdate )
426
+ {
427
+ return _processHelper . BeginProcess ( this , noCheckAndUpdate ) ;
428
+ }
429
+
430
+ /// <summary>
431
+ /// If not nested in a call to <c>BeginProcess</c> on this session, set its session id in context.
432
+ /// </summary>
433
+ /// <returns>
434
+ /// If not already processing, an object to dispose for restoring the previous session id.
435
+ /// Otherwise, <see langword="null" />.
436
+ /// </returns>
437
+ public IDisposable BeginContext ( )
423
438
{
424
439
return _processHelper . Processing ? null : SessionIdLoggingContext . CreateOrNull ( SessionId ) ;
425
440
}
@@ -442,15 +457,22 @@ public ProcessHelper()
442
457
443
458
public bool Processing { get => _processing ; }
444
459
445
- public IDisposable BeginProcess ( AbstractSessionImpl session )
460
+ public IDisposable BeginProcess ( AbstractSessionImpl session , bool noCheckAndUpdate = false )
446
461
{
447
462
if ( _processing )
448
463
return null ;
449
464
450
465
try
451
466
{
452
467
_context = SessionIdLoggingContext . CreateOrNull ( session . SessionId ) ;
453
- session . CheckAndUpdateSessionStatus ( ) ;
468
+ if ( noCheckAndUpdate )
469
+ {
470
+ session . TransactionContext ? . Wait ( ) ;
471
+ }
472
+ else
473
+ {
474
+ session . CheckAndUpdateSessionStatus ( ) ;
475
+ }
454
476
_processing = true ;
455
477
}
456
478
catch
0 commit comments