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
originalIdentity
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
SubjectstringThe identifier of the identity, referred to as subject.
NamestringName of the identity.
UserNamestringOptional username, defaults to empty string.
OnBehalfOfIdentityOptional 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
System
The identity used when the system is the cause.
public static readonly Identity System
Field Value
Unknown
The identity used when the identity is not known.
public static readonly Identity Unknown
Field Value
Properties
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
Name
Name of the identity.
public string Name { get; init; }
Property Value
OnBehalfOf
Optional behalf of Identity.
public Identity? OnBehalfOf { get; init; }
Property Value
Subject
The identifier of the identity, referred to as subject.
public string Subject { get; init; }
Property Value
UserName
Optional username, defaults to empty string.
public string UserName { get; init; }
Property Value
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
Equals(Identity?)
public virtual bool Equals(Identity? other)
Parameters
otherIdentity
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
public override string ToString()
Returns
WithoutDuplicates()
Returns a new Identity chain with duplicate subjects removed. The first occurrence of each subject is kept.
public Identity WithoutDuplicates()
Returns
Operators
operator ==(Identity?, Identity?)
public static bool operator ==(Identity? left, Identity? right)
Parameters
Returns
operator !=(Identity?, Identity?)
public static bool operator !=(Identity? left, Identity? right)