Table of Contents

Class TenantId

Namespace
Excalibur.Dispatch
Assembly
Excalibur.Dispatch.Abstractions.dll

Concrete tenant identifier message value-type.

public sealed class TenantId : IEquatable<TenantId>
Inheritance
TenantId
Implements
Inherited Members
Extension Methods

Remarks

The identifier is validated once, at construction, and is immutable thereafter. Those two properties are what make a tenant check meaningful: a value that could be changed after it was authorised would let a caller pass a scope check and then operate as a different tenant, and a value that silently substituted something for a missing identifier would make "no tenant was supplied" indistinguishable from a real scope. Both are refused here rather than normalised away.

Comparison is ordinal and case-sensitive, matching the tenant term used by the scoping types and by the storage predicates built from them. Two identifiers differing only in case are two different tenants.

Constructors

TenantId(string)

Initializes a new instance of the TenantId class with the specified value.

public TenantId(string value)

Parameters

value string

The tenant identifier value.

Exceptions

ArgumentException

value is null, empty, or whitespace — a missing tenant is rejected rather than coerced: substituting an empty value would produce an identifier that no longer names the tenant the caller intended, with no diagnostic at the point the mistake was made — or longer than MaxLength characters, which no shipped provider can store whole.

Fields

MaxLength

The longest tenant identifier every shipped provider is guaranteed to store whole.

public const int MaxLength = 64

Field Value

int

Remarks

Fixed at the narrowest shipped tenant column across every provider, not the widest: a caller-supplied identifier this constructor accepts must never be silently truncated by any provider it can reach, and truncation is the dangerous outcome — a truncated identifier can collide with another tenant's. Rejecting at construction, where the caller still has context, is cheaper than discovering the mismatch as a provider-specific truncation or constraint error far from the call that caused it.

Properties

Value

Gets the tenant identifier value. Never null, empty, or whitespace.

public string Value { get; }

Property Value

string

The unique tenant identifier string.

Methods

Equals(TenantId?)

Determines whether the specified TenantId is equal to the current instance.

public bool Equals(TenantId? other)

Parameters

other TenantId

The TenantId to compare.

Returns

bool

true if the specified TenantId is equal to the current instance; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current instance.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the specified object is equal to the current instance; otherwise, false.

FromString(string)

Creates a new TenantId from the specified string value.

public static TenantId FromString(string value)

Parameters

value string

The string value.

Returns

TenantId

A new TenantId instance.

Exceptions

ArgumentException

value is null, empty, whitespace, or longer than MaxLength characters.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer hash code.

ToString()

Represents text as a sequence of UTF-16 code units.

public override string ToString()

Returns

string