Make DelegateEndpointConventionBuilder constructors public#36492
Make DelegateEndpointConventionBuilder constructors public#36492dougbu merged 3 commits intorelease/6.0from
Conversation
|
Thank you for your API proposal. I'm removing the |
|
@dotnet/aspnet-build Can I get help merging? The Linux helix run has passed for this but the other legs are stuck: https://helix.dot.net/api/jobs/cfb0e973-8053-41c1-a5be-8e37deee1a86/workitems?api-version=2019-06-17 Edit: Actually looks like all the Helix legs passed successfully |
|
Do not merge this as-is |
|
See The Shipped files should never change except immediately after an RTM release e.g. 6.0.0. In between, change PublicAPI.Unshipped.txt files. Add |
| *REMOVED*Microsoft.AspNetCore.Routing.RouteNameMetadata.RouteName.get -> string! | ||
| *REMOVED*Microsoft.AspNetCore.Routing.RouteNameMetadata.RouteNameMetadata(string! routeName) -> void | ||
| Microsoft.AspNetCore.Builder.DelegateEndpointConventionBuilder | ||
| Microsoft.AspNetCore.Builder.DelegateEndpointConventionBuilder.DelegateEndpointConventionBuilder(System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Builder.IEndpointConventionBuilder!>! endpointConventionBuilders) -> void |
There was a problem hiding this comment.
Put another way: Unless this was in 5.0.0, the method hasn't shipped.
* Make DelegateEndpointConventionBuilder constructors public * Address API review feedback * Only expose a single constructor
…36549) * Make DelegateEndpointConventionBuilder constructors public (#36492) * Make DelegateEndpointConventionBuilder constructors public * Address API review feedback * Only expose a single constructor * Update src/Http/Routing/src/Builder/DelegateEndpointConventionBuilder.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> Co-authored-by: Pranav K <prkrishn@hotmail.com>
Background and Motivation
For .NET 6, we added support for OpenAPI extension methods on the
DelegateEndpointConventionBuilderused in minimal apps. TheDelegateEndpointConventionBuilderis currently implemented as apublic sealedclass withinternalconstructors.While debugging a scenario, we realized that this posed a problem for scenarios where developers wanted to use the extension methods on a builder returned from a 3rd-party API or external source.
Proposed API
namespace Microsoft.AspNetCore.Builder { public class DelegateEndpointConventionBuilder { - internal DelegateEndpointConventionBuilder(List<IEndpointConventionBuilder> endpointConventionBuilders) + public DelegateEndpointConventionBuilder(List<IEndpointConventionBuilder> endpointConventionBuilders) }Usage Examples
Alternative Designs
One alternative is to have the extension methods target
IEndpointConventionBuilderinstead ofDelegateEndpointConventionBuilderbut this presents some problems because:Produces<TResponse>(TBuilder)Risks
DelegateEndpointConventionBuilderwas introduced in .NET 6 so this is not a breaking change.IEndpointConventionBuilders theDelegateEndpointConventionBuilderhas a requirement for this type of extensibility so it's the only one that follows the pattern of public class and public constructor.