Skip to content
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

Scoped lifetime does not work (as expected) in a WebApi project #70

Open
duongphuhiep opened this issue Aug 21, 2024 · 2 comments
Open

Comments

@duongphuhiep
Copy link

This demo shows the issue:

You can run the following (failed) test to reproduce the issue:

https://github.com/duongphuhiep/PureDIBugDemo/blob/master/WebAPI.Tests/BasicTests.cs

Kind regards

@NikolayPianikov
Copy link
Member

You are correct and thank you for your research.

There's question #43. That's what it's about. I have not found an extension point that would allow to build into the Scope mechanism for ASP.NET. I've read several related posts and they discuss this possibility. Maybe I'm missing something and you know of a way to do this?

Anyway I'll see if something has changed and there are extension points.

@NikolayPianikov
Copy link
Member

NikolayPianikov commented Aug 21, 2024

Here's an example or this. We need to intercept session creation and do something like this:

var session = new Composition(baseComposition);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants