Table of Contents

Class BasePipeContext

Namespace
MassTransit.Middleware
Assembly
MassTransit.Abstractions.dll

The base for a pipe context, with the underlying support for managing payloads (out-of-band data that is carried along with the context).

public abstract class BasePipeContext : PipeContext
Inheritance
BasePipeContext
Implements
Inherited Members
Extension Methods

Constructors

BasePipeContext()

A pipe with no cancellation support

protected BasePipeContext()

BasePipeContext(IPayloadCache)

A pipe with no cancellation support, using the specified payloadCache

protected BasePipeContext(IPayloadCache payloadCache)

Parameters

payloadCache IPayloadCache

BasePipeContext(IPayloadCache, CancellationToken)

A pipe using the specified cancellationToken and payloadCache

protected BasePipeContext(IPayloadCache payloadCache, CancellationToken cancellationToken)

Parameters

payloadCache IPayloadCache

A payload cache

cancellationToken CancellationToken

A cancellation token

BasePipeContext(params object[]?)

A pipe with no cancellation support

protected BasePipeContext(params object[]? payloads)

Parameters

payloads object[]

Loads the payload cache with the specified objects

BasePipeContext(CancellationToken)

A pipe using the specified cancellationToken

protected BasePipeContext(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token

BasePipeContext(CancellationToken, params object[]?)

A pipe using the specified cancellationToken

protected BasePipeContext(CancellationToken cancellationToken, params object[]? payloads)

Parameters

cancellationToken CancellationToken

A cancellation token

payloads object[]

Loads the payload cache with the specified objects

Properties

CancellationToken

Returns the CancellationToken for the context (implicit interface)

public virtual CancellationToken CancellationToken { get; }

Property Value

CancellationToken

PayloadCache

protected IPayloadCache PayloadCache { get; }

Property Value

IPayloadCache

Methods

AddOrUpdatePayload<T>(PayloadFactory<T>, UpdatePayloadFactory<T>)

Either adds a new payload, or updates an existing payload

public virtual T AddOrUpdatePayload<T>(PayloadFactory<T> addFactory, UpdatePayloadFactory<T> updateFactory) where T : class

Parameters

addFactory PayloadFactory<T>

The payload factory called if the payload is not present

updateFactory UpdatePayloadFactory<T>

The payload factory called if the payload already exists

Returns

T

Type Parameters

T

The payload type

GetOrAddPayload<T>(PayloadFactory<T>)

Get or add a payload to the context, using the provided payload factory.

public virtual T GetOrAddPayload<T>(PayloadFactory<T> payloadFactory) where T : class

Parameters

payloadFactory PayloadFactory<T>

The payload factory, which is only invoked if the payload is not present.

Returns

T

Type Parameters

T

The payload type

HasPayloadType(Type)

Returns true if the payload type is included with or supported by the context type

public virtual bool HasPayloadType(Type payloadType)

Parameters

payloadType Type

Returns

bool

TryGetPayload<T>(out T?)

Attempts to get the specified payload type

public virtual bool TryGetPayload<T>(out T? payload) where T : class

Parameters

payload T

Returns

bool

Type Parameters

T