1
1
// Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
+ using Microsoft . AspNetCore . Http ;
5
+
4
6
namespace Microsoft . AspNetCore . Routing
5
7
{
6
8
/// <summary>
7
9
/// Defines a contract to generate a URL from a template.
8
10
/// </summary>
11
+ /// <remarks>
12
+ /// A <see cref="LinkGenerationTemplate"/> can be created from <see cref="LinkGenerator.GetTemplateByAddress{TAddress}(TAddress)"/>
13
+ /// by supplying an address value which has matching endpoints. The returned <see cref="LinkGenerationTemplate"/>
14
+ /// will be bound to the endpoints matching the address that was originally provided.
15
+ /// </remarks>
9
16
public abstract class LinkGenerationTemplate
10
17
{
11
18
/// <summary>
12
- /// Generates a URL with an absolute path from the specified route values.
19
+ /// Generates a URI with an absolute path based on the provided values.
20
+ /// </summary>
21
+ /// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
22
+ /// <param name="values">The route values. Used to expand parameters in the route template. Optional.</param>
23
+ /// <param name="fragment">An optional URI fragment. Appended to the resulting URI.</param>
24
+ /// <param name="options">
25
+ /// An optional <see cref="LinkOptions"/>. Settings on provided object override the settings with matching
26
+ /// names from <c>RouteOptions</c>.
27
+ /// </param>
28
+ /// <returns>A URI with an absolute path, or <c>null</c>.</returns>
29
+ public abstract string GetPath (
30
+ HttpContext httpContext ,
31
+ object values ,
32
+ FragmentString fragment = default ,
33
+ LinkOptions options = default ) ;
34
+
35
+ /// <summary>
36
+ /// Generates a URI with an absolute path based on the provided values.
37
+ /// </summary>
38
+ /// <param name="values">The route values. Used to expand parameters in the route template. Optional.</param>
39
+ /// <param name="pathBase">An optional URI path base. Prepended to the path in the resulting URI.</param>
40
+ /// <param name="fragment">An optional URI fragment. Appended to the resulting URI.</param>
41
+ /// <param name="options">
42
+ /// An optional <see cref="LinkOptions"/>. Settings on provided object override the settings with matching
43
+ /// names from <c>RouteOptions</c>.
44
+ /// </param>
45
+ /// <returns>A URI with an absolute path, or <c>null</c>.</returns>
46
+ public abstract string GetPath (
47
+ object values ,
48
+ PathString pathBase = default ,
49
+ FragmentString fragment = default ,
50
+ LinkOptions options = default ) ;
51
+
52
+ /// <summary>
53
+ /// Generates an absolute URI based on the provided values.
13
54
/// </summary>
14
- /// <param name="values">An object that contains route values.</param>
15
- /// <returns>The generated URL.</returns>
16
- public string MakeUrl ( object values )
17
- {
18
- return MakeUrl ( values , options : null ) ;
19
- }
55
+ /// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
56
+ /// <param name="values">The route values. Used to expand parameters in the route template. Optional.</param>
57
+ /// <param name="fragment">An optional URI fragment. Appended to the resulting URI.</param>
58
+ /// <param name="options">
59
+ /// An optional <see cref="LinkOptions"/>. Settings on provided object override the settings with matching
60
+ /// names from <c>RouteOptions</c>.
61
+ /// </param>
62
+ /// <returns>A URI with an absolute path, or <c>null</c>.</returns>
63
+ public abstract string GetUri (
64
+ HttpContext httpContext ,
65
+ object values ,
66
+ FragmentString fragment = default ,
67
+ LinkOptions options = default ) ;
20
68
21
69
/// <summary>
22
- /// Generates a URL with an absolute path from the specified route values and link options .
70
+ /// Generates an absolute URI based on the provided values.
23
71
/// </summary>
24
- /// <param name="values">An object that contains route values.</param>
25
- /// <param name="options">The <see cref="LinkOptions"/>.</param>
26
- /// <returns>The generated URL.</returns>
27
- public abstract string MakeUrl ( object values , LinkOptions options ) ;
72
+ /// <param name="values">The route values. Used to expand parameters in the route template. Optional.</param>
73
+ /// <param name="scheme">The URI scheme, applied to the resulting URI.</param>
74
+ /// <param name="host">The URI host/authority, applied to the resulting URI.</param>
75
+ /// <param name="pathBase">An optional URI path base. Prepended to the path in the resulting URI.</param>
76
+ /// <param name="fragment">An optional URI fragment. Appended to the resulting URI.</param>
77
+ /// <param name="options">
78
+ /// An optional <see cref="LinkOptions"/>. Settings on provided object override the settings with matching
79
+ /// names from <c>RouteOptions</c>.
80
+ /// </param>
81
+ /// <returns>An absolute URI, or <c>null</c>.</returns>
82
+ public abstract string GetUri (
83
+ object values ,
84
+ string scheme ,
85
+ HostString host ,
86
+ PathString pathBase = default ,
87
+ FragmentString fragment = default ,
88
+ LinkOptions options = default ) ;
28
89
}
29
90
}
0 commit comments