Skip to content

RequestDelegateFactory context classes ApplicationServices property #41952

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

Merged

Conversation

DamianEdwards
Copy link
Member

@DamianEdwards DamianEdwards commented May 31, 2022

  • Added public IServiceProvider? Services { get; } property to RouteHandlerContext
  • Enables route handler filter factories to access app services
  • Added a unit test & updated another to ensure app's service provider is passed through correctly by RequestDelegateFactory
  • Renamed EndpointMetadataContext.Services and EndpointParameterMetadataContext.Services to ApplicationServices and made non-nullable
  • Added unit tests to ensure context ApplicationServices property is set correctly

Fixes #41900

- Added `public IServiceProvider? Services { get; }` property to `RouteHandlerContext`
- Enables route handler filter factories to access app services
- Added a unit test & updated another to ensure app's service provider is passed through correctly by `RequestDelegateFactory`

Fixes #41900
@DamianEdwards DamianEdwards requested a review from a team May 31, 2022 22:06
@ghost ghost added the area-runtime label May 31, 2022
@DamianEdwards DamianEdwards changed the title Add RouteHandlerContext.Services property Add RouteHandlerContext.ApplicationServices property Jun 3, 2022
@DamianEdwards DamianEdwards changed the title Add RouteHandlerContext.ApplicationServices property RequestDelegateFactory context classes ApplicationServices property Jun 3, 2022
Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should wait for API approval just in case it changes of course.

@DamianEdwards DamianEdwards added the * NO MERGE * Do not merge this PR as long as this label is present. label Jun 3, 2022
@DamianEdwards DamianEdwards removed the * NO MERGE * Do not merge this PR as long as this label is present. label Jun 6, 2022
@DamianEdwards DamianEdwards merged commit f73497c into main Jun 6, 2022
@DamianEdwards DamianEdwards deleted the damianedwards/41900-routehandlercontext-services branch June 6, 2022 18:01
@ghost ghost added this to the 7.0-preview6 milestone Jun 6, 2022
captainsafia pushed a commit to captainsafia/aspnetcore that referenced this pull request Jun 13, 2022
…otnet#41952)

- Added `public IServiceProvider ApplicationServices { get; }` property to `RouteHandlerContext`
  - Enables route handler filter factories to access app services
- Renamed existing `Services` property on `EndpointParameterMetadataContext` and `EndpointMetadataContext` to `ApplicationServices` and made it non-nullable
- Added a unit test & updated another to ensure app's service provider is passed through correctly by `RequestDelegateFactory`

Fixes dotnet#41900
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add access to services for route handler filter factories to RouteHandlerContext
5 participants