EndpointBuilder.ServiceProvider should be non-nullabe and renamed to ApplicationServices #42137
Labels
api-approved
API was approved in API review, it can be implemented
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Milestone
Background and Motivation
We missed this when renaming
Services
toApplicationServices
on a few other types in #41900 (comment).Proposed API
Usage Examples
Alternative Designs
Keep
ApplicationServices
nullable.OpenApiRouteHandlerBuilderExtensions
currently has different behavior if theIServiceProvider
is null or not. If it's null it doesn't add any metadata to the endpoint.aspnetcore/src/OpenApi/src/OpenApiRouteHandlerBuilderExtensions.cs
Lines 70 to 78 in f5ee9e3
Is this what we want for
WithOpenApi
? Could it be valid to change behavior given a "null"ServiceProvider
for other things adding endpoint metadata? What about route handler filters withRouteHandlerContext.ApplicationServices
? Technically, we're only hiding information by making these non-nullable. Maybe this is best to hide this information so people don't short circuit for a null service provider. I'm not sure. What do we think @captainsafia @DamianEdwards @davidfowl?We could also keep the
ServiceProvider
name even though we've avoided it in other APIs. It does align withIEndpointRouteBuilder.ServiceProvider
that first shipped in 3.0. I do like the increased clarity ofApplicationServices
though, and we seem to use that in more places.Risks
This hasn't shipped in a major release, so the risk is not doing this before we are unable to make breaking changes.
The text was updated successfully, but these errors were encountered: