Table of Contents

Interface IPayloadCache

Namespace
MassTransit.Payloads
Assembly
MassTransit.Abstractions.dll

The context properties

public interface IPayloadCache

Methods

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

Either adds a new payload, or updates an existing payload

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>)

Return an existing or create a new property

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

Parameters

payloadFactory PayloadFactory<T>

Returns

T

Type Parameters

T

HasPayloadType(Type)

Checks if the property exists in the cache

bool HasPayloadType(Type payloadType)

Parameters

payloadType Type

The property type

Returns

bool

True if the property exists in the cache, otherwise false

TryGetPayload<TPayload>(out TPayload?)

Returns the value of the property if it exists in the cache

bool TryGetPayload<TPayload>(out TPayload? payload) where TPayload : class

Parameters

payload TPayload

The property value

Returns

bool

True if the value was returned, otherwise false

Type Parameters

TPayload

The property type