MicrosoftDocs / OData-docs

Creative Commons Attribution 4.0 International
32 stars 109 forks source link

Mention that service scope should be created for each request when injecting a custom service provider #328

Open habbes opened 2 weeks ago

habbes commented 2 weeks ago

When customers create a custom service provide to configure customer services to pass to IODataResponseMessage and pass to ODataMessageWriter, for example when changing the default JSON writer, it's one obvious that a custom service scope should be created for each request because AddDefaultODataServices(). When a service scope is not created, the scoped service instances end being shared across requests, which can lead to data races.