File tree 2 files changed +23
-1
lines changed
src/Middleware/Diagnostics
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public class ExceptionHandlerOptions
22
22
/// replace it on <see cref="HttpContext.RequestServices"/> when re-executing the request to handle an error.
23
23
/// </summary>
24
24
/// <remarks>The default value is <see langword="false"/>.</remarks>
25
- public bool CreateScopeForErrors { get ; set ; }
25
+ public bool CreateScopeForErrors { get ; set ; } = true ;
26
26
27
27
/// <summary>
28
28
/// The <see cref="RequestDelegate" /> that will handle the exception. If this is not
Original file line number Diff line number Diff line change @@ -396,7 +396,29 @@ private class TestServiceProvider : IServiceProvider
396
396
{
397
397
public object GetService ( Type serviceType )
398
398
{
399
+ if ( serviceType == typeof ( IServiceScopeFactory ) )
400
+ {
401
+ return new TestServiceScopeFactory ( ) ;
402
+ }
403
+
399
404
throw new NotImplementedException ( ) ;
400
405
}
401
406
}
407
+
408
+ private class TestServiceScopeFactory : IServiceScopeFactory
409
+ {
410
+ public IServiceScope CreateScope ( )
411
+ {
412
+ return new TestServiceScope ( ) ;
413
+ }
414
+ }
415
+
416
+ private class TestServiceScope : IServiceScope
417
+ {
418
+ public IServiceProvider ServiceProvider => new TestServiceProvider ( ) ;
419
+
420
+ public void Dispose ( )
421
+ {
422
+ }
423
+ }
402
424
}
You can’t perform that action at this time.
0 commit comments