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)

根據提供的值產生具有絕對路徑的 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,如果 null 無法建立 URI,則為 。

適用於

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

根據提供的值產生具有絕對路徑的 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,如果 null 無法建立 URI,則為 。

適用於