question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ASP.NET Core and Validators with Scoped Dependancies

See original GitHub issue

Using 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:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JeremySkinnercommented, Apr 17, 2017

I’ve published 7.0-beta2. Please give it a try.

0reactions
JeremySkinnercommented, Apr 21, 2017

Great! I’ll close this for now. Let me know if you run into any further issues.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found