Share via


ResourceBuilderExtensions.WithUrl Method

Definition

Overloads

WithUrl<T>(IResourceBuilder<T>, ReferenceExpression, String)

Adds a URL to be displayed for the resource.

WithUrl<T>(IResourceBuilder<T>, ReferenceExpression+ExpressionInterpolatedStringHandler, String)

Adds a URL to be displayed for the resource.

WithUrl<T>(IResourceBuilder<T>, String, String)

Adds a URL to be displayed for the resource.

WithUrl<T>(IResourceBuilder<T>, ReferenceExpression, String)

Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs

Adds a URL to be displayed for the resource.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithUrl<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, Aspire.Hosting.ApplicationModel.ReferenceExpression url, string? displayText = default) where T : Aspire.Hosting.ApplicationModel.IResource;
static member WithUrl : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> * Aspire.Hosting.ApplicationModel.ReferenceExpression * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)
<Extension()>
Public Function WithUrl(Of T As IResource) (builder As IResourceBuilder(Of T), url As ReferenceExpression, Optional displayText As String = Nothing) As IResourceBuilder(Of T)

Type Parameters

T

The resource type.

Parameters

builder
IResourceBuilder<T>

The builder for the resource.

url
ReferenceExpression

A ReferenceExpression that will produce the URL.

displayText
String

The display text to show when the link is displayed.

Returns

The IResourceBuilder<T>.

Remarks

Use this method to add a URL to be displayed for the resource.
Note that any endpoints on the resource will automatically get a corresponding URL added for them.

Applies to

WithUrl<T>(IResourceBuilder<T>, ReferenceExpression+ExpressionInterpolatedStringHandler, String)

Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs

Adds a URL to be displayed for the resource.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithUrl<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, in Aspire.Hosting.ApplicationModel.ReferenceExpression.ExpressionInterpolatedStringHandler url, string? displayText = default) where T : Aspire.Hosting.ApplicationModel.IResource;
static member WithUrl : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> * ExpressionInterpolatedStringHandler * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)
<Extension()>
Public Function WithUrl(Of T As IResource) (builder As IResourceBuilder(Of T), ByRef url As ReferenceExpression.ExpressionInterpolatedStringHandler, Optional displayText As String = Nothing) As IResourceBuilder(Of T)

Type Parameters

T

The resource type.

Parameters

builder
IResourceBuilder<T>

The builder for the resource.

url
ReferenceExpression.ExpressionInterpolatedStringHandler

The interpolated string that produces the URL.

displayText
String

The display text to show when the link is displayed.

Returns

The IResourceBuilder<T>.

Remarks

Use this method to add a URL to be displayed for the resource.
Note that any endpoints on the resource will automatically get a corresponding URL added for them.

Applies to

WithUrl<T>(IResourceBuilder<T>, String, String)

Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs

Adds a URL to be displayed for the resource.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithUrl<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, string url, string? displayText = default) where T : Aspire.Hosting.ApplicationModel.IResource;
static member WithUrl : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)
<Extension()>
Public Function WithUrl(Of T As IResource) (builder As IResourceBuilder(Of T), url As String, Optional displayText As String = Nothing) As IResourceBuilder(Of T)

Type Parameters

T

The resource type.

Parameters

builder
IResourceBuilder<T>

The builder for the resource.

url
String

A URL to show for the resource.

displayText
String

The display text to show when the link is displayed.

Returns

The IResourceBuilder<T>.

Examples

Add a static URL to be displayed for the resource:

var frontend = builder.AddProject<Projects.Frontend>("frontend")
                      .WithUrl("https://example.com/", "Home");

Update all displayed URLs to use the specified path and (optional) display text:

var frontend = builder.AddProject<Projects.Frontend>("frontend")
                      .WithUrl("/home", "Home");

Remarks

Use this method to add a URL to be displayed for the resource.
If the URL is relative, it will be applied to all URLs for the resource, replacing the path portion of the URL.
Note that any endpoints on the resource will automatically get a corresponding URL added for them.
To modify the URL for a specific endpoint, use WithUrlForEndpoint<T>(IResourceBuilder<T>, String, Action<ResourceUrlAnnotation>).

Applies to