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

InvocationContext derivatives hold a reference to a non scoped IServiceProvider. #14

Closed
jspuij opened this issue Jul 18, 2019 · 4 comments
Assignees
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@jspuij
Copy link
Owner

jspuij commented Jul 18, 2019

The idea of the developers was that InvocationContext derivatives would provide a reference to a scoped IServiceProvider.

unfortunately ApiBase is singleton and InvocationContext derivates are (and were) instantiated with Api.ServiceProvider as reference. This means that they receive a non scoped container and All AddScoped<> services will effectively return a singleton.

SubIssue of #13.

@jspuij jspuij self-assigned this Jul 18, 2019
@jspuij
Copy link
Owner Author

jspuij commented Jul 18, 2019

@jspuij
Copy link
Owner Author

jspuij commented Jul 18, 2019

services.AddScoped<RestierQueryExecutorOptions>() is an example where it goes horribly wrong. A single RestierQueryExecutorOptions instance is used, which makes multiple concurrent queries with and without TotalCount possibly get the wrong results or no count where one was requested or vice versa.

@jspuij jspuij added the bug Something isn't working label Jul 18, 2019
@jspuij
Copy link
Owner Author

jspuij commented Jul 19, 2019

Part of OData#629

@jspuij
Copy link
Owner Author

jspuij commented Jul 23, 2019

It seems I was wrong. ApiBase is scoped, although the documentation suggests it's not. The documentation talks about the Configuration being singleton, and I incorrectly assumed that ApiBase would be singleton in Total.

@jspuij jspuij closed this as completed Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant