ASP.NET Core and Validators with Scoped Dependancies
See original GitHub issueUsing the aspnetcore package validators are using globally scoped dependencies and not scoped as they are configured. This is not good for Entity Framework DbContexts or anything user specific as they’re getting created once when the validator first requests them.
I can’t find any documentation on how IObjectModelValidator
works but I’m guessing it’s more of a middleware process that MVC action filter where dependencies would be scoped properly?
Am I barking up the wrong tree or is this an issue?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Dependency injection in ASP.NET Core
ASP.NET Core supports the dependency injection (DI) software design pattern, ... NET. For more information, see Scope validation.
Read more >Dependency Injection Lifetime Validation - Weblogs @ ASP.NET
Notice the ValidateScopes and ValidateOnBuild properties. The first will prevent a singleton service from taking a scoped service dependency, ...
Read more >Net core DI Scope validation , scoped vs transient?
A transient is a new instance per constructor injection ie per dependency. Generally you would us the singleton pattern to maintain perhaps some ......
Read more >ASP.NET Core Scope Validation
ValidateScopes to true if the app's environment is Development. When ValidateScopes is set to true , the default service provider performs ...
Read more >Top Misconceptions About Dependency Injection in ASP.NET ...
The misconception is that ASP.NET Core validation for captive dependencies will always work. However, in ASP.NET core, captive dependency ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve published 7.0-beta2. Please give it a try.
Great! I’ll close this for now. Let me know if you run into any further issues.