Class EventSourceId<T>

Namespace
Cratis.Chronicle.Events
Assembly
Cratis.Chronicle.dll

Represents a type-safe event source identifier wrapping a strongly-typed value. The generic type parameter is passed directly to ConceptAs<T>, giving value-equality semantics over T while also supporting implicit conversion to and from the untyped EventSourceId for wire compatibility.

public record EventSourceId<T> : ConceptAs<T>, IComparable<ConceptAs<T>>, IComparable<T>, IComparable, IEquatable<ConceptAs<T>>, IEquatable<EventSourceId<T>> where T : IComparable

Type Parameters

T

The type of the underlying value. Supported types are string, Guid, ConceptAs<T> wrappers over supported primitives, and comparable formattable values. Formattable values use invariant culture, with round-trip formatting for dates and times. Other types must provide a stable ToString() representation.

Inheritance
EventSourceId<T>
Implements
Inherited Members
Extension Methods

Constructors

EventSourceId(EventSourceId<T>)

protected EventSourceId(EventSourceId<T> original)

Parameters

original EventSourceId<T>

EventSourceId(T)

Represents a type-safe event source identifier wrapping a strongly-typed value. The generic type parameter is passed directly to ConceptAs<T>, giving value-equality semantics over T while also supporting implicit conversion to and from the untyped EventSourceId for wire compatibility.

public EventSourceId(T TypedValue)

Parameters

TypedValue T

The typed value that this identifier wraps.

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

TypedValue

The typed value that this identifier wraps.

public T TypedValue { get; init; }

Property Value

T

Methods

Deconstruct(out T)

public void Deconstruct(out T TypedValue)

Parameters

TypedValue T

Equals(EventSourceId<T>?)

public virtual bool Equals(EventSourceId<T>? other)

Parameters

other EventSourceId<T>

Returns

bool

Equals(ConceptAs<T>?)

public override sealed bool Equals(ConceptAs<T>? other)

Parameters

other ConceptAs<T>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

From(EventSourceId)

Create an EventSourceId<T> from an EventSourceId, parsing its string value back into T.

public static EventSourceId<T> From(EventSourceId id)

Parameters

id EventSourceId

EventSourceId to convert from.

Returns

EventSourceId<T>

A converted EventSourceId<T>.

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Operators

operator ==(EventSourceId<T>?, EventSourceId<T>?)

public static bool operator ==(EventSourceId<T>? left, EventSourceId<T>? right)

Parameters

left EventSourceId<T>
right EventSourceId<T>

Returns

bool

implicit operator EventSourceId<T>(EventSourceId)

Implicitly convert from an untyped EventSourceId to EventSourceId<T> by parsing the string value into T.

public static implicit operator EventSourceId<T>(EventSourceId id)

Parameters

id EventSourceId

EventSourceId to convert from.

Returns

EventSourceId<T>

A converted EventSourceId<T>.

implicit operator EventSourceId(EventSourceId<T>)

Implicitly convert from EventSourceId<T> to an untyped EventSourceId by serializing the typed value to its string representation.

public static implicit operator EventSourceId(EventSourceId<T> id)

Parameters

id EventSourceId<T>

EventSourceId<T> to convert from.

Returns

EventSourceId

An untyped EventSourceId carrying the string representation.

implicit operator T(EventSourceId<T>)

Implicitly convert from EventSourceId<T> to T.

public static implicit operator T(EventSourceId<T> id)

Parameters

id EventSourceId<T>

EventSourceId<T> to convert from.

Returns

T

The underlying typed value.

implicit operator EventSourceId<T>(string)

Implicitly convert from string to EventSourceId<T>, parsing the string value into T.

public static implicit operator EventSourceId<T>(string value)

Parameters

value string

string to convert from.

Returns

EventSourceId<T>

A converted EventSourceId<T>.

implicit operator EventSourceId<T>(T)

Implicitly convert from T to EventSourceId<T>.

public static implicit operator EventSourceId<T>(T value)

Parameters

value T

Value to convert from.

Returns

EventSourceId<T>

A converted EventSourceId<T>.

operator !=(EventSourceId<T>?, EventSourceId<T>?)

public static bool operator !=(EventSourceId<T>? left, EventSourceId<T>? right)

Parameters

left EventSourceId<T>
right EventSourceId<T>

Returns

bool