-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
Map extensions that hang off IEndpointRouteBuilder return IEndpointConventionBuilder. This is fine and good.
Can we imagine scenarios where someone wants to return a more strongly typed builder? For example, from gRPC's MapGrpcService I return an GrpcEndpointRouteBuilder. It implements convention builder but there is also some gRPC specific stuff on there, and gRPC extension methods.
public class GrpcEndpointRouteBuilder : IEndpointConventionBuilder
{
public GrpcEndpointRouteBuilder ConfigureCrazyGrpcStuff(Action a)
{
a();
return this;
}
}Today all our IEndpointConventionBuilder extension methods return IEndpointConventionBuilder which would make using a strongly typed builder difficult.
routes.MapGrpcService<MyService>()
.RequireAuthorization("policy")
.ConfigureCrazyGrpcStuff(() => {}) // error, reference is no longer the gRPC builderShould our extension methods be more like:
public TBuilder RequireAuthorization<TBuilder>(TBuilder builder, string policyName) where TBuilder : IEndpointConventionBuilder
{
// stuff
return builder;
}Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one