共用方式為


DistributedApplicationEventing.PublishAsync Method

Definition

Overloads

PublishAsync<T>(T, CancellationToken)

Publishes an event to all subscribes of the specific event type.

PublishAsync<T>(T, EventDispatchBehavior, CancellationToken)

Publishes an event to all subscribes of the specific event type.

PublishAsync<T>(T, CancellationToken)

Source:
DistributedApplicationEventing.cs
Source:
DistributedApplicationEventing.cs

Publishes an event to all subscribes of the specific event type.

public System.Threading.Tasks.Task PublishAsync<T> (T event, System.Threading.CancellationToken cancellationToken = default) where T : Aspire.Hosting.Eventing.IDistributedApplicationEvent;
abstract member PublishAsync : 'T * System.Threading.CancellationToken -> System.Threading.Tasks.Task (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationEvent)
override this.PublishAsync : 'T * System.Threading.CancellationToken -> System.Threading.Tasks.Task (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationEvent)
Public Function PublishAsync(Of T As IDistributedApplicationEvent) (event As T, Optional cancellationToken As CancellationToken = Nothing) As Task

Type Parameters

T

The type of the event

Parameters

event
T

The event.

cancellationToken
CancellationToken

A cancellation token.

Returns

A task that can be awaited.

Implements

Applies to

PublishAsync<T>(T, EventDispatchBehavior, CancellationToken)

Source:
DistributedApplicationEventing.cs

Publishes an event to all subscribes of the specific event type.

public System.Threading.Tasks.Task PublishAsync<T> (T event, Aspire.Hosting.Eventing.EventDispatchBehavior dispatchBehavior, System.Threading.CancellationToken cancellationToken = default) where T : Aspire.Hosting.Eventing.IDistributedApplicationEvent;
abstract member PublishAsync : 'T * Aspire.Hosting.Eventing.EventDispatchBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationEvent)
override this.PublishAsync : 'T * Aspire.Hosting.Eventing.EventDispatchBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationEvent)
Public Function PublishAsync(Of T As IDistributedApplicationEvent) (event As T, dispatchBehavior As EventDispatchBehavior, Optional cancellationToken As CancellationToken = Nothing) As Task

Type Parameters

T

The type of the event

Parameters

event
T

The event.

dispatchBehavior
EventDispatchBehavior
cancellationToken
CancellationToken

A cancellation token.

Returns

A task that can be awaited.

Implements

Applies to