File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
src/Middleware/Diagnostics Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public class ExceptionHandlerOptions
2222 /// replace it on <see cref="HttpContext.RequestServices"/> when re-executing the request to handle an error.
2323 /// </summary>
2424 /// <remarks>The default value is <see langword="false"/>.</remarks>
25- public bool CreateScopeForErrors { get ; set ; }
25+ public bool CreateScopeForErrors { get ; set ; } = true ;
2626
2727 /// <summary>
2828 /// 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
396396 {
397397 public object GetService ( Type serviceType )
398398 {
399+ if ( serviceType == typeof ( IServiceScopeFactory ) )
400+ {
401+ return new TestServiceScopeFactory ( ) ;
402+ }
403+
399404 throw new NotImplementedException ( ) ;
400405 }
401406 }
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+ }
402424}
You can’t perform that action at this time.
0 commit comments