diff --git a/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs index 34d84c42b8..36c7574ce3 100644 --- a/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs @@ -19,7 +19,8 @@ namespace Microsoft.Extensions.DependencyInjection /// Adds services required for routing requests. /// /// The to add the services to. - public static void AddRouting(this IServiceCollection services) + /// The so that additional calls can be chained. + public static IServiceCollection AddRouting(this IServiceCollection services) { if (services == null) { @@ -36,6 +37,8 @@ namespace Microsoft.Extensions.DependencyInjection }); services.TryAddSingleton(typeof(RoutingMarkerService)); + + return services; } /// @@ -43,7 +46,8 @@ namespace Microsoft.Extensions.DependencyInjection /// /// The to add the services to. /// The routing options to configure the middleware with. - public static void AddRouting( + /// The so that additional calls can be chained. + public static IServiceCollection AddRouting( this IServiceCollection services, Action configureOptions) { @@ -59,6 +63,8 @@ namespace Microsoft.Extensions.DependencyInjection services.Configure(configureOptions); services.AddRouting(); + + return services; } } } \ No newline at end of file