MicrosoftDocs / OData-docs

Creative Commons Attribution 4.0 International
33 stars 110 forks source link

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

Open habbes opened 2 months ago

habbes commented 2 months 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.