Skip to main content
The MatchRoom entity represents a head-to-head match in the elimination stage of the tournament. Each match has two teams, a referee, and tracks the pick/ban phase and match results.

Class Definition

Namespace: ss.Internal.Management.Server.AutoRef Table: match_rooms Source: /home/daytona/workspace/source/ss.Integrated.Management.Server/Database/Models.cs:125
[Table("match_rooms")]
public class MatchRoom
{
    // Properties...
}

Properties

Id
string
required
The unique identifier for the match (e.g., “A1”, “C2”, “GF1”).Column: id (Primary Key)
RoundId
int
required
Foreign key reference to the Round that governs this match’s rules and map pool.Column: round_idRelationship: Many-to-one with Round
TeamRedId
int
required
Foreign key to the User representing the red team.Column: team_red_idRelationship: Many-to-one with User
TeamBlueId
int
required
Foreign key to the User representing the blue team.Column: team_blue_idRelationship: Many-to-one with User
RefereeId
int?
The ID of the referee assigned to manage this match. Nullable if no referee is assigned yet.Column: referee_idRelationship: Many-to-one with RefereeInfo
StartTime
DateTime?
The scheduled start time for the match in UTC. Nullable if not yet scheduled.Column: start_time
EndTime
DateTime?
The actual end time of the match in UTC. Set when the match concludes.Column: end_time
BannedMaps
List<RoundChoice>?
JSON-stored list of maps banned during the pick/ban phase.Each entry records which team banned which map slot.Column: banned_mapsStorage: JSON array
PickedMaps
List<RoundChoice>?
JSON-stored list of maps picked during the match.Each entry records which team picked the map, and optionally which team won it.Column: picked_mapsStorage: JSON array
The numerical ID of the Bancho Match History.Used to construct the URL: https://osu.ppy.sh/community/matches/{MpLinkId}Column: mp_link_id
Round
Round
Navigation property to the Round entity that defines this match’s rules.
[ForeignKey("RoundId")]
public virtual Round Round { get; set; }
TeamRed
User
Navigation property to the User representing the red team.
[ForeignKey("TeamRedId")]
public virtual User TeamRed { get; set; }
TeamBlue
User
Navigation property to the User representing the blue team.
[ForeignKey("TeamBlueId")]
public virtual User TeamBlue { get; set; }
Referee
RefereeInfo
Navigation property to the RefereeInfo entity assigned to manage this match.
[ForeignKey("RefereeId")]
public virtual RefereeInfo Referee { get; set; }

JSON-Stored Fields

RoundChoice Structure

Both BannedMaps and PickedMaps use the RoundChoice type:
public class RoundChoice
{
    public string Slot { get; set; }           // e.g., "NM1", "HD2"
    public TeamColor TeamColor { get; set; }   // TeamRed or TeamBlue
    public TeamColor? Winner { get; set; }     // Only for PickedMaps
}
Example JSON:
[
  { "Slot": "NM1", "TeamColor": 1, "Winner": 0 },
  { "Slot": "HD2", "TeamColor": 0, "Winner": 0 },
  { "Slot": "DT1", "TeamColor": 1, "Winner": 1 }
]

Usage Examples

Creating a Match

var match = new MatchRoom
{
    Id = "GF1",
    RoundId = 5,
    TeamRedId = 101,
    TeamBlueId = 102,
    RefereeId = 10,
    StartTime = DateTime.UtcNow.AddDays(2)
};

context.MatchRooms.Add(match);
await context.SaveChangesAsync();

Recording Picks and Bans

match.BannedMaps = new List<RoundChoice>
{
    new() { Slot = "NM1", TeamColor = TeamColor.TeamRed },
    new() { Slot = "HD3", TeamColor = TeamColor.TeamBlue }
};

match.PickedMaps = new List<RoundChoice>
{
    new() { Slot = "DT2", TeamColor = TeamColor.TeamRed, Winner = TeamColor.TeamRed },
    new() { Slot = "FM1", TeamColor = TeamColor.TeamBlue, Winner = TeamColor.TeamBlue }
};

await context.SaveChangesAsync();

Querying with Relationships

var match = await context.MatchRooms
    .Include(m => m.Round)
    .Include(m => m.TeamRed)
        .ThenInclude(u => u.OsuData)
    .Include(m => m.TeamBlue)
        .ThenInclude(u => u.OsuData)
    .Include(m => m.Referee)
    .FirstOrDefaultAsync(m => m.Id == "GF1");

Console.WriteLine($"{match.TeamRed.DisplayName} vs {match.TeamBlue.DisplayName}");
Console.WriteLine($"Best of {match.Round.BestOf}");
Console.WriteLine($"Referee: {match.Referee?.DisplayName ?? "TBD"}");

Build docs developers (and LLMs) love