From 133a7e0414ffeb6af54093bb678afb3d401248e0 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Fri, 18 Jan 2019 07:23:47 +1300 Subject: [PATCH] Add XML docs to endpoint route builder and extensions (#6700) --- .../Builder/EndpointRouteBuilderExtensions.cs | 138 ++++++++++++++++++ src/Http/Routing/src/IEndpointRouteBuilder.cs | 18 ++- 2 files changed, 154 insertions(+), 2 deletions(-) diff --git a/src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs b/src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs index 2b655cc808..27b048debc 100644 --- a/src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs +++ b/src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs @@ -10,6 +10,9 @@ using Microsoft.AspNetCore.Routing.Patterns; namespace Microsoft.AspNetCore.Builder { + /// + /// Provides extension methods for to add endpoints. + /// public static class EndpointRouteBuilderExtensions { // Avoid creating a new array every call @@ -19,6 +22,15 @@ namespace Microsoft.AspNetCore.Builder private static readonly string[] DeleteVerb = new[] { "DELETE" }; #region MapVerbs + /// + /// Adds a to the that matches HTTP GET requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapGet( this IEndpointRouteBuilder builder, string pattern, @@ -28,6 +40,16 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName: null, requestDelegate, GetVerb, metadata); } + /// + /// Adds a to the that matches HTTP GET requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapGet( this IEndpointRouteBuilder builder, string pattern, @@ -38,6 +60,15 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName, requestDelegate, GetVerb, metadata); } + /// + /// Adds a to the that matches HTTP POST requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapPost( this IEndpointRouteBuilder builder, string pattern, @@ -47,6 +78,16 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName: null, requestDelegate, PostVerb, metadata); } + /// + /// Adds a to the that matches HTTP POST requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapPost( this IEndpointRouteBuilder builder, string pattern, @@ -57,6 +98,15 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName, requestDelegate, PostVerb, metadata); } + /// + /// Adds a to the that matches HTTP PUT requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapPut( this IEndpointRouteBuilder builder, string pattern, @@ -66,6 +116,16 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName: null, requestDelegate, PutVerb, metadata); } + /// + /// Adds a to the that matches HTTP PUT requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapPut( this IEndpointRouteBuilder builder, string pattern, @@ -76,6 +136,15 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName, requestDelegate, PutVerb, metadata); } + /// + /// Adds a to the that matches HTTP DELETE requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapDelete( this IEndpointRouteBuilder builder, string pattern, @@ -85,6 +154,16 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName: null, requestDelegate, DeleteVerb, metadata); } + /// + /// Adds a to the that matches HTTP DELETE requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapDelete( this IEndpointRouteBuilder builder, string pattern, @@ -95,6 +174,16 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName, requestDelegate, DeleteVerb, metadata); } + /// + /// Adds a to the that matches HTTP requests + /// for the specified HTTP methods and pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// HTTP methods that the endpoint will match. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapVerbs( this IEndpointRouteBuilder builder, string pattern, @@ -105,6 +194,17 @@ namespace Microsoft.AspNetCore.Builder return MapVerbs(builder, pattern, displayName: null, requestDelegate, httpMethods, metadata); } + /// + /// Adds a to the that matches HTTP requests + /// for the specified HTTP methods and pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// HTTP methods that the endpoint will match. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder MapVerbs( this IEndpointRouteBuilder builder, string pattern, @@ -130,6 +230,15 @@ namespace Microsoft.AspNetCore.Builder #endregion #region Map + /// + /// Adds a to the that matches HTTP requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder Map( this IEndpointRouteBuilder builder, string pattern, @@ -139,6 +248,16 @@ namespace Microsoft.AspNetCore.Builder return Map(builder, RoutePatternFactory.Parse(pattern), pattern, requestDelegate, metadata); } + /// + /// Adds a to the that matches HTTP requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder Map( this IEndpointRouteBuilder builder, string pattern, @@ -149,6 +268,15 @@ namespace Microsoft.AspNetCore.Builder return Map(builder, RoutePatternFactory.Parse(pattern), displayName, requestDelegate, metadata); } + /// + /// Adds a to the that matches HTTP requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder Map( this IEndpointRouteBuilder builder, RoutePattern pattern, @@ -158,6 +286,16 @@ namespace Microsoft.AspNetCore.Builder return Map(builder, pattern, pattern.RawText ?? pattern.DebuggerToString(), requestDelegate, metadata); } + /// + /// Adds a to the that matches HTTP requests + /// for the specified pattern. + /// + /// The to add the route to. + /// The route pattern. + /// The display name for the endpoint. + /// The delegate executed when the endpoint is matched. + /// Metadata that is added to the endpoint. + /// A that can be used to further customize the endpoint. public static IEndpointConventionBuilder Map( this IEndpointRouteBuilder builder, RoutePattern pattern, diff --git a/src/Http/Routing/src/IEndpointRouteBuilder.cs b/src/Http/Routing/src/IEndpointRouteBuilder.cs index 4d2d1eb69c..6e941a0685 100644 --- a/src/Http/Routing/src/IEndpointRouteBuilder.cs +++ b/src/Http/Routing/src/IEndpointRouteBuilder.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -7,12 +7,26 @@ using Microsoft.AspNetCore.Builder; namespace Microsoft.AspNetCore.Routing { + /// + /// Defines a contract for a route builder in an application. A route builder specifies the routes for + /// an application. + /// public interface IEndpointRouteBuilder { + /// + /// Creates a new . + /// + /// The new . IApplicationBuilder CreateApplicationBuilder(); + /// + /// Gets the sets the used to resolve services for routes. + /// IServiceProvider ServiceProvider { get; } + /// + /// Gets the endpoint data sources configured in the builder. + /// ICollection DataSources { get; } } -} \ No newline at end of file +}