Table of Contents

Class ActivityContext

Namespace
Excalibur.Application
Assembly
Excalibur.Application.dll

Represents a context for managing activity-related data within an application.

public sealed class ActivityContext : IActivityContext
Inheritance
ActivityContext
Implements
Inherited Members
Extension Methods

Constructors

ActivityContext(string, ICorrelationId, IETag, IConfiguration, IClientAddress, IServiceProvider)

Initializes a new instance of the ActivityContext class with essential dependencies.

public ActivityContext(string tenantId, ICorrelationId correlationId, IETag eTag, IConfiguration configuration, IClientAddress clientAddress, IServiceProvider serviceProvider)

Parameters

tenantId string

The resolved tenant identifier value.

correlationId ICorrelationId

The correlation identifier.

eTag IETag

The ETag for concurrency control.

configuration IConfiguration

The application configuration.

clientAddress IClientAddress

The client address.

serviceProvider IServiceProvider

The service provider for dependency Excalibur.Tests.Integration.

Methods

ContainsKey(string)

Checks if the context contains a value for the specified key.

public bool ContainsKey(string key)

Parameters

key string

The key to check for existence in the context.

Returns

bool

true if the key exists in the context; otherwise, false .

GetValue<T>(string, T)

Retrieves a value from the context by its key, or returns a default value if the key is not found.

public T GetValue<T>(string key, T defaultValue)

Parameters

key string

The key associated with the value to retrieve.

defaultValue T

The default value to return if the key does not exist or the value is null .

Returns

T

The value associated with the specified key, or defaultValue if the key does not exist.

Type Parameters

T

The type of the value to retrieve.

Exceptions

ArgumentException

Thrown if key is null , empty, or whitespace.

Remove(string)

Removes a value from the context for the specified key.

public void Remove(string key)

Parameters

key string

The key associated with the value to remove.

Exceptions

ArgumentException

Thrown if key is null , empty, or whitespace.

SetValue<T>(string, T)

Sets a value in the context for the specified key.

public void SetValue<T>(string key, T value)

Parameters

key string

The key to associate with the value.

value T

The value to store in the context.

Type Parameters

T

The type of the value to set.

Exceptions

ArgumentException

Thrown if key is null , empty, or whitespace.