logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class LeaderboardRecordMapping

    Maps between LeaderboardEntry and the generic StructuredRecord shape, and builds the field-name-driven ordering/schema pieces StructuredStoreLeaderboardAdapter needs. The single place that knows the leaderboard table's column names.

    Inheritance
    object
    LeaderboardRecordMapping
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Leaderboard.Infrastructure
    Assembly: Serenity.Leaderboard.Infrastructure.dll
    Syntax
    public static class LeaderboardRecordMapping

    Fields

    AchievedAtTicksField

    Field name storing AchievedAtUtcTicks.

    Declaration
    public const string AchievedAtTicksField = "achieved_at_ticks"
    Field Value
    Type Description
    string

    BoardIdField

    Field name storing Board.

    Declaration
    public const string BoardIdField = "board_id"
    Field Value
    Type Description
    string

    DefaultTableName

    The default table or collection name used when the settings leave it blank.

    Declaration
    public const string DefaultTableName = "serenity_leaderboard"
    Field Value
    Type Description
    string

    DisplayNameField

    Field name storing DisplayName.

    Declaration
    public const string DisplayNameField = "display_name"
    Field Value
    Type Description
    string

    DistinctByPlayer

    The distinct-by field used to collapse raw rows to one per player.

    Declaration
    public static readonly IReadOnlyList<string> DistinctByPlayer
    Field Value
    Type Description
    IReadOnlyList<string>

    KeyFieldsBoardAndPlayer

    The PlayerIdField/BoardIdField key used to identify a player's row within a board for upsert-if-better.

    Declaration
    public static readonly IReadOnlyList<string> KeyFieldsBoardAndPlayer
    Field Value
    Type Description
    IReadOnlyList<string>

    MetadataField

    Field name storing Metadata.

    Declaration
    public const string MetadataField = "metadata"
    Field Value
    Type Description
    string

    PlayerIdField

    Field name storing Player.

    Declaration
    public const string PlayerIdField = "player_id"
    Field Value
    Type Description
    string

    ScoreField

    Field name storing Value.

    Declaration
    public const string ScoreField = "score"
    Field Value
    Type Description
    string

    Methods

    BuildBoardScopeFilters(BoardId)

    Builds the board_id = board scope/query filter shared by every board-scoped operation.

    Declaration
    public static IReadOnlyList<FieldFilter> BuildBoardScopeFilters(BoardId board)
    Parameters
    Type Name Description
    BoardId board
    Returns
    Type Description
    IReadOnlyList<FieldFilter>

    BuildOrderFields(LeaderboardSortDirection)

    Builds the full ranking order: ScoreField per direction, then AchievedAtTicksField ascending (earlier wins ties), then PlayerIdField ascending (final deterministic tiebreak) — matching Sort(IReadOnlyList<LeaderboardEntry>, LeaderboardSortDirection)'s tie-break policy exactly, so every backend orders identically.

    Declaration
    public static IReadOnlyList<OrderField> BuildOrderFields(LeaderboardSortDirection direction)
    Parameters
    Type Name Description
    LeaderboardSortDirection direction
    Returns
    Type Description
    IReadOnlyList<OrderField>

    BuildSchema(StoreTable)

    Builds the leaderboard table schema: fields, identity column, and the board/score/tie-break index.

    Declaration
    public static StructuredTableSchema BuildSchema(StoreTable table)
    Parameters
    Type Name Description
    StoreTable table
    Returns
    Type Description
    StructuredTableSchema

    ToEntries(IReadOnlyList<StructuredRecord>, BoardId)

    Maps a list of StructuredRecord back to LeaderboardEntry instances for the given board, preserving order.

    Declaration
    public static IReadOnlyList<LeaderboardEntry> ToEntries(IReadOnlyList<StructuredRecord> records, BoardId board)
    Parameters
    Type Name Description
    IReadOnlyList<StructuredRecord> records
    BoardId board
    Returns
    Type Description
    IReadOnlyList<LeaderboardEntry>

    ToEntry(StructuredRecord, BoardId)

    Maps a StructuredRecord back to a LeaderboardEntry for the given board.

    Declaration
    public static LeaderboardEntry ToEntry(StructuredRecord record, BoardId board)
    Parameters
    Type Name Description
    StructuredRecord record
    BoardId board
    Returns
    Type Description
    LeaderboardEntry

    ToRecord(LeaderboardEntry)

    Maps a LeaderboardEntry to its StructuredRecord field representation.

    Declaration
    public static StructuredRecord ToRecord(LeaderboardEntry entry)
    Parameters
    Type Name Description
    LeaderboardEntry entry
    Returns
    Type Description
    StructuredRecord

    ToStructuredDirection(LeaderboardSortDirection)

    Maps a LeaderboardSortDirection to its StructuredSortDirection equivalent.

    Declaration
    public static StructuredSortDirection ToStructuredDirection(LeaderboardSortDirection direction)
    Parameters
    Type Name Description
    LeaderboardSortDirection direction
    Returns
    Type Description
    StructuredSortDirection
    In this article
    © 2026 Serenity. All Rights Reserved