Table of Contents

Class UseEndpoint<TArg, TResult>

Namespace
Phetch.Blazor
Assembly
Phetch.Blazor.dll

A component that can be used to call an endpoint and access the result.

public class UseEndpoint<TArg, TResult> : UseEndpointBase<TArg, TResult>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Type Parameters

TArg
TResult
Inheritance
UseEndpointBase<TArg, TResult>
UseEndpoint<TArg, TResult>
Implements
Inherited Members

Remarks

If you're calling a ParameterlessEndpoint<TResult>, you should use UseParameterlessEndpoint<TResult> instead.

Properties

Arg

The argument to supply to the query. If not supplied, the query will not be run automatically.

[Parameter]
public TArg Arg { get; set; }

Property Value

TArg

AutoFetch

If set to true (the default) and the Arg has been set, the query will be run automatically when the component is initialized. This does not affect manual query invocations using methods on the Query object.

[Parameter]
public bool AutoFetch { get; set; }

Property Value

bool

Remarks

This is useful for delaying queries until the data they depend on is available. If no value for Arg is provided, this has no effect.

ChildContent

[Parameter]
[EditorRequired]
public RenderFragment<Query<TArg, TResult>> ChildContent { get; set; }

Property Value

RenderFragment<Query<TArg, TResult>>

Endpoint

The endpoint to use.

[Parameter]
[EditorRequired]
public Endpoint<TArg, TResult> Endpoint { get; set; }

Property Value

Endpoint<TArg, TResult>

Skip

If true, the query will not be run automatically. This does not affect manual query invocations using methods on the Query object.

[Parameter]
[Obsolete("Use AutoFetch instead. This will be removed in a future version of Phetch.")]
public bool Skip { get; set; }

Property Value

bool

Remarks

This is useful for delaying queries until the data they depend on is available. If no value for Arg is provided, this has no effect.

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

CreateQuery(Endpoint<TArg, TResult>)

protected override Query<TArg, TResult> CreateQuery(Endpoint<TArg, TResult> endpoint)

Parameters

endpoint Endpoint<TArg, TResult>

Returns

Query<TArg, TResult>

OnParametersSet()

Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.

protected override void OnParametersSet()