ControllerLinkGeneratorExtensions.GetPathByAction 方法

定义

重载

GetPathByAction(LinkGenerator, String, String, Object, PathString, FragmentString, LinkOptions)

根据提供的值生成具有绝对路径的 URI。

GetPathByAction(LinkGenerator, HttpContext, String, String, Object, Nullable<PathString>, FragmentString, LinkOptions)

根据提供的值生成具有绝对路径的 URI。

GetPathByAction(LinkGenerator, String, String, Object, PathString, FragmentString, LinkOptions)

Source:
ControllerLinkGeneratorExtensions.cs

根据提供的值生成具有绝对路径的 URI。

public static string GetPathByAction (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string action, string controller, object values = default, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions options = default);
public static string? GetPathByAction (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string action, string controller, object? values = default, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetPathByAction : Microsoft.AspNetCore.Routing.LinkGenerator * string * string * obj * Microsoft.AspNetCore.Http.PathString * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetPathByAction (generator As LinkGenerator, action As String, controller As String, Optional values As Object = Nothing, Optional pathBase As PathString = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

参数

action
String

操作名称。 用于解析终结点。

controller
String

控制器名称。 用于解析终结点。

values
Object

路由值。 可选。 用于解析路由模板中的终结点和展开参数。

pathBase
PathString

可选的 URI 路径基。 追加到生成的 URI 中的路径前面。

fragment
FragmentString

URI 片段。 可选。 追加到生成的 URI。

options
LinkOptions

一个可选的 LinkOptions。 提供的 对象上的设置将覆盖具有匹配名称的设置 RouteOptions

返回

具有绝对路径的 URI;如果无法创建 URI, null 则为 。

适用于

GetPathByAction(LinkGenerator, HttpContext, String, String, Object, Nullable<PathString>, FragmentString, LinkOptions)

Source:
ControllerLinkGeneratorExtensions.cs

根据提供的值生成具有绝对路径的 URI。

public static string GetPathByAction (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string action = default, string controller = default, object values = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions options = default);
public static string? GetPathByAction (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string? action = default, string? controller = default, object? values = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetPathByAction : Microsoft.AspNetCore.Routing.LinkGenerator * Microsoft.AspNetCore.Http.HttpContext * string * string * obj * Nullable<Microsoft.AspNetCore.Http.PathString> * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetPathByAction (generator As LinkGenerator, httpContext As HttpContext, Optional action As String = Nothing, Optional controller As String = Nothing, Optional values As Object = Nothing, Optional pathBase As Nullable(Of PathString) = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

参数

httpContext
HttpContext

HttpContext与当前请求关联的 。

action
String

操作名称。 用于解析终结点。 可选。 如果 null 提供 ,则将使用当前操作路由值。

controller
String

控制器名称。 用于解析终结点。 可选。 如果 null 提供 ,则将使用当前控制器路由值。

values
Object

路由值。 可选。 用于解析路由模板中的终结点和展开参数。

pathBase
Nullable<PathString>

可选的 URI 路径基。 追加到生成的 URI 中的路径前面。 如果未提供,将使用 的值 PathBase

fragment
FragmentString

URI 片段。 可选。 追加到生成的 URI。

options
LinkOptions

一个可选的 LinkOptions。 提供的 对象上的设置将覆盖具有匹配名称的设置 RouteOptions

返回

具有绝对路径的 URI;如果无法创建 URI, null 则为 。

适用于