Table of Contents

Class TeamEntityBase<TTeamMemberModel>

Namespace
Tharga.Team.MongoDB
Assembly
Tharga.Team.MongoDB.dll
public abstract record TeamEntityBase<TTeamMemberModel> : EntityBase, ISupportInitialize, IEquatable<PersistableEntityBase>, IEntity<ObjectId>, IEquatable<EntityBase<ObjectId>>, IEquatable<EntityBase>, ITeam<TTeamMemberModel>, ITeam, IEquatable<TeamEntityBase<TTeamMemberModel>> where TTeamMemberModel : TeamMemberBase

Type Parameters

TTeamMemberModel
Inheritance
PersistableEntityBase
EntityBase<ObjectId>
EntityBase
TeamEntityBase<TTeamMemberModel>
Implements
IEquatable<PersistableEntityBase>
IEntity<ObjectId>
IEquatable<EntityBase<ObjectId>>
IEquatable<EntityBase>
ITeam<TTeamMemberModel>
IEquatable<TeamEntityBase<TTeamMemberModel>>
Derived
Inherited Members
EntityBase.GetHashCode()
EntityBase.Equals(EntityBase<ObjectId>)
EntityBase.Equals(EntityBase)
EntityBase.<Clone>$()
EntityBase.EqualityContract
EntityBase<ObjectId>.Equals(PersistableEntityBase)
EntityBase<ObjectId>.Id
PersistableEntityBase.NeedsCleaning()
PersistableEntityBase.BeginInit()
PersistableEntityBase.EndInit()
PersistableEntityBase.CatchAll

Properties

ConsentAccessLevel

Access level granted to consented roles. Null falls back to the configured default consent level.

[BsonIgnoreIfNull]
[BsonRepresentation(BsonType.String)]
public AccessLevel? ConsentAccessLevel { get; init; }

Property Value

AccessLevel?

ConsentedRoles

Global roles that have been granted access to this team via consent. Null or empty means no consent granted.

[BsonIgnoreIfNull]
public string[] ConsentedRoles { get; init; }

Property Value

string[]

CustomRoles

Custom roles defined at runtime for this team (created / updated / deleted without a code deploy). Null or empty means only code-registered roles apply. Each role's scopes are constrained to app-registered scopes.

[BsonIgnoreIfNull]
public IReadOnlyList<TenantRoleDefinition> CustomRoles { get; init; }

Property Value

IReadOnlyList<TenantRoleDefinition>

DeletedAt

When the team was soft-deleted, or null while it is live. See DeletedAt.

[BsonIgnoreIfNull]
public DateTime? DeletedAt { get; init; }

Property Value

DateTime?

Remarks

BsonIgnoreIfNull, so a live team's document is byte-identical to one written before soft delete existed — nothing to migrate, and an existing document reads back as live because the field is absent.

DeletedBy

Identity of whoever soft-deleted the team. See DeletedBy.

[BsonIgnoreIfNull]
public string DeletedBy { get; init; }

Property Value

string

Icon

[BsonIgnoreIfNull]
public string Icon { get; init; }

Property Value

string

IsDeleted

Whether the team is soft-deleted, derived from DeletedAt and never stored.

[BsonIgnore]
public bool IsDeleted { get; }

Property Value

bool

Remarks

BsonIgnore is load-bearing: persisting it would create a second copy of the same fact, free to drift from the timestamp it is supposed to summarise. Queries filter on DeletedAt for the same reason — it is the stored truth.

Key

public required string Key { get; init; }

Property Value

string

Members

public TTeamMemberModel[] Members { get; init; }

Property Value

TTeamMemberModel[]

Name

public required string Name { get; init; }

Property Value

string

Methods

ToString()

The team's Name, so a team rendered as text names itself.

public override sealed string ToString()

Returns

string

Remarks

Replaces the record dump the compiler would otherwise synthesize. A UI control bound to a team falls back to ToString() for the text it cannot get from a display property — Radzen's dropdown does exactly this for its hidden accessible input — which put the entity id, the consent access level and every property a host had added onto the page (Tharga/Team#254).

sealed is load-bearing. A record synthesizes its own ToString() in every declaration unless a base declares a sealed override, so without it each host's record TeamEntity : TeamEntityBase<TeamMember>; would silently regenerate the dump and the fix would reach nobody. The cost is deliberate and worth naming: a host can no longer give its team entity a ToString() of its own.