-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ninject 3.2.2 InRequestScope not returning the same instance for the same request #30
Comments
I also encountered a similar issue. Basically, Ninject.Web.Commons uses Check out the file /src/Ninject.Web.Common/WebCommonNinjectModule.cs |
I use owin host web api envirement and it still doesn't work |
We face this same issue when using async code with ConfigureAwait(false) with the service locator (anti)pattern inside that code. |
@cornillemichiel you can check out this project. https://github.com/neuecc/OwinRequestScopeContext |
@foresightyj I checked it out, . but is this a Ninject compatible thing? |
Yeah it works perfectly fine for more than a year already. This is my extension method:
|
I had the same problem and found that there were no component implementation of INinjectHttpApplicationPlugin included nor loaded, and since it worked when using the older Ninject.Web (whos nuget package does not support the latest release of Ninject) library I found that creating a custom module and loading it (or just adding the component directly) solved it (for the HttpContext.Current but will probably be portable to the OWIN pipeline as well).
And the call is made from the InRequestScope extension method (see below) |
a new instance was created each time.
this is my binding
Bind().To().InRequestScope();
The text was updated successfully, but these errors were encountered: