Return IServiceCollection from AddRouting extension methods

This commit is contained in:
jacalvar 2016-03-28 15:40:57 -07:00
parent 39b4f6fe53
commit 5bcea61743
1 changed files with 8 additions and 2 deletions

View File

@ -19,7 +19,8 @@ namespace Microsoft.Extensions.DependencyInjection
/// Adds services required for routing requests. /// Adds services required for routing requests.
/// </summary> /// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param> /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
public static void AddRouting(this IServiceCollection services) /// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddRouting(this IServiceCollection services)
{ {
if (services == null) if (services == null)
{ {
@ -36,6 +37,8 @@ namespace Microsoft.Extensions.DependencyInjection
}); });
services.TryAddSingleton(typeof(RoutingMarkerService)); services.TryAddSingleton(typeof(RoutingMarkerService));
return services;
} }
/// <summary> /// <summary>
@ -43,7 +46,8 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary> /// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param> /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <param name="configureOptions">The routing options to configure the middleware with.</param> /// <param name="configureOptions">The routing options to configure the middleware with.</param>
public static void AddRouting( /// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddRouting(
this IServiceCollection services, this IServiceCollection services,
Action<RouteOptions> configureOptions) Action<RouteOptions> configureOptions)
{ {
@ -59,6 +63,8 @@ namespace Microsoft.Extensions.DependencyInjection
services.Configure(configureOptions); services.Configure(configureOptions);
services.AddRouting(); services.AddRouting();
return services;
} }
} }
} }