Class Invitation
Represents an invitation code that can be used for invite-only user registration.
public class Invitation
- Inheritance
-
Invitation
- Inherited Members
Remarks
Invitations control access to the platform by requiring a valid invitation code during registration. Each invitation can have a maximum number of uses, an expiration date, and an optional label for tracking. The IsActive() method determines if an invitation can still be used.
Properties
Code
Gets or sets the unique invitation code that users must provide during registration.
public string Code { get; set; }
Property Value
- string
- Represents an invitation code that can be used for invite-only user registration.
Remarks
This code should be unique across all invitations and is typically a randomly generated string.
CreatedAt
Gets or sets the UTC timestamp when this invitation was created.
public DateTime CreatedAt { get; set; }
Property Value
- DateTime
- Represents an invitation code that can be used for invite-only user registration.
CreatedBy
Gets or sets the user who created this invitation.
public User CreatedBy { get; set; }
Property Value
- User
- Represents an invitation code that can be used for invite-only user registration.
CreatedByUserId
Gets or sets the unique identifier of the user who created this invitation.
public Guid CreatedByUserId { get; set; }
Property Value
- Guid
- Represents an invitation code that can be used for invite-only user registration.
ExpiresAt
Gets or sets the UTC timestamp when this invitation expires, or null if it never expires.
public DateTime? ExpiresAt { get; set; }
Property Value
- DateTime?
- Represents an invitation code that can be used for invite-only user registration.
Remarks
If set, the invitation cannot be used after this date. If null, the invitation does not expire (but may still be invalidated by reaching MaxUses).
Id
Gets or sets the unique identifier for this invitation.
public Guid Id { get; set; }
Property Value
- Guid
- Represents an invitation code that can be used for invite-only user registration.
Label
Gets or sets an optional label or description for this invitation, useful for tracking or administrative purposes.
public string? Label { get; set; }
Property Value
- string
- Represents an invitation code that can be used for invite-only user registration.
MaxUses
Gets or sets the maximum number of times this invitation can be used for registration.
public int MaxUses { get; set; }
Property Value
- int
- Represents an invitation code that can be used for invite-only user registration.
Remarks
Defaults to 1, meaning the invitation can only be used once. Set to a higher value to allow multiple users to register with the same invitation code.
UsedCount
Gets or sets the number of times this invitation has been used for registration.
public int UsedCount { get; set; }
Property Value
- int
- Represents an invitation code that can be used for invite-only user registration.
Remarks
This counter is incremented each time a user successfully registers using this invitation code.
Users
Gets or sets the collection of users who registered using this invitation code.
public List<User> Users { get; set; }
Property Value
Methods
IsActive()
Determines whether this invitation is currently active and can be used for registration.
public bool IsActive()
Returns
- bool
trueif the invitation has not exceeded its maximum uses and has not expired; otherwise,false.