Class Identity

Namespace
Cratis.Chronicle.Identities
Assembly
Cratis.Chronicle.dll

Represents an identity of something that is responsible for causing a state change.

public record Identity : IEquatable<Identity>
Inheritance
Identity
Implements
Inherited Members
Extension Methods

Remarks

An identity can be a user, a system, a service or anything else that can be identified.

Constructors

Identity(Identity)

protected Identity(Identity original)

Parameters

original Identity

Identity(string, string, string, Identity?)

Represents an identity of something that is responsible for causing a state change.

public Identity(string Subject, string Name, string UserName = "", Identity? OnBehalfOf = null)

Parameters

Subject string

The identifier of the identity, referred to as subject.

Name string

Name of the identity.

UserName string

Optional username, defaults to empty string.

OnBehalfOf Identity

Optional behalf of Identity.

Remarks

An identity can be a user, a system, a service or anything else that can be identified.

Fields

NotSet

The identity used when not set.

public static readonly Identity NotSet

Field Value

Identity

System

The identity used when the system is the cause.

public static readonly Identity System

Field Value

Identity

Unknown

The identity used when the identity is not known.

public static readonly Identity Unknown

Field Value

Identity

Properties

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Name

Name of the identity.

public string Name { get; init; }

Property Value

string

OnBehalfOf

Optional behalf of Identity.

public Identity? OnBehalfOf { get; init; }

Property Value

Identity

Subject

The identifier of the identity, referred to as subject.

public string Subject { get; init; }

Property Value

string

UserName

Optional username, defaults to empty string.

public string UserName { get; init; }

Property Value

string

Methods

Deconstruct(out string, out string, out string, out Identity?)

public void Deconstruct(out string Subject, out string Name, out string UserName, out Identity? OnBehalfOf)

Parameters

Subject string
Name string
UserName string
OnBehalfOf Identity

Equals(Identity?)

public virtual bool Equals(Identity? other)

Parameters

other Identity

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

WithoutDuplicates()

Returns a new Identity chain with duplicate subjects removed. The first occurrence of each subject is kept.

public Identity WithoutDuplicates()

Returns

Identity

A new Identity with duplicates removed from the chain.

Operators

operator ==(Identity?, Identity?)

public static bool operator ==(Identity? left, Identity? right)

Parameters

left Identity
right Identity

Returns

bool

operator !=(Identity?, Identity?)

public static bool operator !=(Identity? left, Identity? right)

Parameters

left Identity
right Identity

Returns

bool