Closed jspuij closed 5 years ago
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.
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.
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 https://github.com/jspuij/RESTier/issues/13.