Table of Contents

Class NpgsqlDbContext

Namespace
FishMMO.Database.Npgsql
Assembly
FishMMO-DB.dll

Entity Framework Core DbContext for the FishMMO PostgreSQL database.

public class NpgsqlDbContext : DbContext, IInfrastructure<IServiceProvider>, IDbContextDependencies, IDbSetCache, IDbContextPoolable, IDisposable, IAsyncDisposable, IResettableService
Inheritance
NpgsqlDbContext
Implements
Inherited Members
Extension Methods

Remarks

This DbContext is created as a short-lived instance via INpgsqlDbContextFactory and is not pooled.

Constructors

NpgsqlDbContext(DbContextOptions, string)

Initializes a new instance of the NpgsqlDbContext class.

public NpgsqlDbContext(DbContextOptions options, string schema)

Parameters

options DbContextOptions

The DbContext options.

schema string

The database schema to use; defaults to DefaultSchema when empty.

Fields

DefaultSchema

Default schema name used when no schema is specified.

public const string DefaultSchema = "public"

Field Value

string

Properties

AccountBetaCodes

Which account redeemed which beta code. Permanent, and deliberately without foreign keys — see AccountBetaCodeEntity.

public DbSet<AccountBetaCodeEntity> AccountBetaCodes { get; set; }

Property Value

DbSet<AccountBetaCodeEntity>

Accounts

Player accounts.

public DbSet<AccountEntity> Accounts { get; set; }

Property Value

DbSet<AccountEntity>

AdminAuditLog

The operator audit log. Append-only; see AdminAuditEntity.

public DbSet<AdminAuditEntity> AdminAuditLog { get; set; }

Property Value

DbSet<AdminAuditEntity>

ArenaMatchMembers

Seats in arena matches.

public DbSet<ArenaMatchMemberEntity> ArenaMatchMembers { get; set; }

Property Value

DbSet<ArenaMatchMemberEntity>

ArenaMatches

Arena matches, live and historical.

public DbSet<ArenaMatchEntity> ArenaMatches { get; set; }

Property Value

DbSet<ArenaMatchEntity>

ArenaPenalties

Arena queue locks.

public DbSet<ArenaPenaltyEntity> ArenaPenalties { get; set; }

Property Value

DbSet<ArenaPenaltyEntity>

ArenaRatings

Per-season ranked arena ratings.

public DbSet<ArenaRatingEntity> ArenaRatings { get; set; }

Property Value

DbSet<ArenaRatingEntity>

ArenaSeasons

Ranked arena seasons.

public DbSet<ArenaSeasonEntity> ArenaSeasons { get; set; }

Property Value

DbSet<ArenaSeasonEntity>

AuthTokens

Authentication tokens.

public DbSet<AuthTokenEntity> AuthTokens { get; set; }

Property Value

DbSet<AuthTokenEntity>

BetaCodes

Beta codes, minted in batches per test program. Revoked, never deleted — see BetaCodeEntity.

public DbSet<BetaCodeEntity> BetaCodes { get; set; }

Property Value

DbSet<BetaCodeEntity>

CharacterAbilities

Character abilities.

public DbSet<CharacterAbilityEntity> CharacterAbilities { get; set; }

Property Value

DbSet<CharacterAbilityEntity>

CharacterAchievements

Character achievements.

public DbSet<CharacterAchievementEntity> CharacterAchievements { get; set; }

Property Value

DbSet<CharacterAchievementEntity>

CharacterArchetypes

Character archetypes.

public DbSet<CharacterArchetypeEntity> CharacterArchetypes { get; set; }

Property Value

DbSet<CharacterArchetypeEntity>

CharacterAttributes

Character attributes.

public DbSet<CharacterAttributeEntity> CharacterAttributes { get; set; }

Property Value

DbSet<CharacterAttributeEntity>

CharacterBuffs

Character buffs.

public DbSet<CharacterBuffEntity> CharacterBuffs { get; set; }

Property Value

DbSet<CharacterBuffEntity>

CharacterDialogueChoices

Per-character dialogue choice bitmasks.

public DbSet<CharacterDialogueChoiceEntity> CharacterDialogueChoices { get; set; }

Property Value

DbSet<CharacterDialogueChoiceEntity>

CharacterFactions

Character faction standings.

public DbSet<CharacterFactionEntity> CharacterFactions { get; set; }

Property Value

DbSet<CharacterFactionEntity>

CharacterFriends

Character friends.

public DbSet<CharacterFriendEntity> CharacterFriends { get; set; }

Property Value

DbSet<CharacterFriendEntity>

CharacterGuilds

Character guild memberships.

public DbSet<CharacterGuildEntity> CharacterGuilds { get; set; }

Property Value

DbSet<CharacterGuildEntity>

CharacterHotkeys

Character hotkeys.

public DbSet<CharacterHotkeyEntity> CharacterHotkeys { get; set; }

Property Value

DbSet<CharacterHotkeyEntity>

CharacterItemCooldowns

Character item cooldowns.

public DbSet<CharacterItemCooldownEntity> CharacterItemCooldowns { get; set; }

Property Value

DbSet<CharacterItemCooldownEntity>

CharacterItems

Every item a character owns, in whichever container holds it.

public DbSet<CharacterItemEntity> CharacterItems { get; set; }

Property Value

DbSet<CharacterItemEntity>

Remarks

One table rather than the three it replaces. Three tables meant three identity sequences, so a row id could not identify an item — see CharacterItemEntity.

CharacterKnownAbilities

Character known abilities.

public DbSet<CharacterKnownAbilityEntity> CharacterKnownAbilities { get; set; }

Property Value

DbSet<CharacterKnownAbilityEntity>

CharacterMail

Character mail.

public DbSet<CharacterMailEntity> CharacterMail { get; set; }

Property Value

DbSet<CharacterMailEntity>

CharacterParties

Character party memberships.

public DbSet<CharacterPartyEntity> CharacterParties { get; set; }

Property Value

DbSet<CharacterPartyEntity>

CharacterPetAttributes

Character pet attributes.

public DbSet<CharacterPetAttributeEntity> CharacterPetAttributes { get; set; }

Property Value

DbSet<CharacterPetAttributeEntity>

CharacterPetBuffs

Character pet buffs.

public DbSet<CharacterPetBuffEntity> CharacterPetBuffs { get; set; }

Property Value

DbSet<CharacterPetBuffEntity>

CharacterPets

Character pets.

public DbSet<CharacterPetEntity> CharacterPets { get; set; }

Property Value

DbSet<CharacterPetEntity>

CharacterPortals

Per-character activated-portal bitmask pages.

public DbSet<CharacterPortalEntity> CharacterPortals { get; set; }

Property Value

DbSet<CharacterPortalEntity>

CharacterQuests

Character quests.

public DbSet<CharacterQuestEntity> CharacterQuests { get; set; }

Property Value

DbSet<CharacterQuestEntity>

CharacterSkills

Character skills.

public DbSet<CharacterSkillEntity> CharacterSkills { get; set; }

Property Value

DbSet<CharacterSkillEntity>

CharacterWaypoints

Per-character discovered-waypoint bitmask pages.

public DbSet<CharacterWaypointEntity> CharacterWaypoints { get; set; }

Property Value

DbSet<CharacterWaypointEntity>

Characters

Player characters.

public DbSet<CharacterEntity> Characters { get; set; }

Property Value

DbSet<CharacterEntity>

Chat

Chat messages.

public DbSet<ChatEntity> Chat { get; set; }

Property Value

DbSet<ChatEntity>

ConnectionTokenKeys

Connection token verification keys (per-region HMAC keys).

public DbSet<ConnectionTokenKeyEntity> ConnectionTokenKeys { get; set; }

Property Value

DbSet<ConnectionTokenKeyEntity>

CurrencyLedger

Completed currency movements, append-only.

public DbSet<CurrencyLedgerEntity> CurrencyLedger { get; set; }

Property Value

DbSet<CurrencyLedgerEntity>

DaemonAppEvents

The supervision history: every change a daemon's heartbeat reported in something it supervises. Append-only; see DaemonAppEventEntity.

public DbSet<DaemonAppEventEntity> DaemonAppEvents { get; set; }

Property Value

DbSet<DaemonAppEventEntity>

Remarks

DaemonApps is overwritten on every beat and therefore says only what is true now. This is the only place a restart that has already been recovered from is recorded at all.

DaemonApps

Applications those daemons supervise, as last reported.

public DbSet<DaemonAppEntity> DaemonApps { get; set; }

Property Value

DbSet<DaemonAppEntity>

DaemonCommands

The daemon command queue. See DaemonCommandEntity.

public DbSet<DaemonCommandEntity> DaemonCommands { get; set; }

Property Value

DbSet<DaemonCommandEntity>

DaemonHosts

Machines running an AppHealthMonitor daemon.

public DbSet<DaemonHostEntity> DaemonHosts { get; set; }

Property Value

DbSet<DaemonHostEntity>

DeploymentSecrets

Deployment-global secrets (loaded at startup instead of env files).

public DbSet<DeploymentSecretEntity> DeploymentSecrets { get; set; }

Property Value

DbSet<DeploymentSecretEntity>

EmailQueue

Email queue.

public DbSet<EmailQueueEntity> EmailQueue { get; set; }

Property Value

DbSet<EmailQueueEntity>

GroupFinderQueue

Characters waiting in, or matched by, the dungeon group finder.

public DbSet<GroupFinderQueueEntity> GroupFinderQueue { get; set; }

Property Value

DbSet<GroupFinderQueueEntity>

GuildApplications

Pending guild recruitment applications.

public DbSet<GuildApplicationEntity> GuildApplications { get; set; }

Property Value

DbSet<GuildApplicationEntity>

GuildLogs

Guild activity log rows.

public DbSet<GuildLogEntity> GuildLogs { get; set; }

Property Value

DbSet<GuildLogEntity>

GuildRanks

Per-guild editable rank rows.

public DbSet<GuildRankEntity> GuildRanks { get; set; }

Property Value

DbSet<GuildRankEntity>

GuildUpdates

Guild update records.

public DbSet<GuildUpdateEntity> GuildUpdates { get; set; }

Property Value

DbSet<GuildUpdateEntity>

Guilds

Guilds.

public DbSet<GuildEntity> Guilds { get; set; }

Property Value

DbSet<GuildEntity>

KickRequests

Kick request records.

public DbSet<KickRequestEntity> KickRequests { get; set; }

Property Value

DbSet<KickRequestEntity>

LoginServerSigningKeys

Login server signing keys.

public DbSet<LoginServerSigningKeyEntity> LoginServerSigningKeys { get; set; }

Property Value

DbSet<LoginServerSigningKeyEntity>

LoginServers

Login server registry.

public DbSet<LoginServerEntity> LoginServers { get; set; }

Property Value

DbSet<LoginServerEntity>

Parties

Parties.

public DbSet<PartyEntity> Parties { get; set; }

Property Value

DbSet<PartyEntity>

PartyUpdates

Party update records.

public DbSet<PartyUpdateEntity> PartyUpdates { get; set; }

Property Value

DbSet<PartyUpdateEntity>

PasswordResetTokens

Outstanding password reset tokens. Stores hashes only, and resetting a password never touches the two-factor columns — see PasswordResetTokenEntity.

public DbSet<PasswordResetTokenEntity> PasswordResetTokens { get; set; }

Property Value

DbSet<PasswordResetTokenEntity>

PlotAccess

Who an owner has let into their plot.

public DbSet<PlotAccessEntity> PlotAccess { get; set; }

Property Value

DbSet<PlotAccessEntity>

PlotStructures

Structures built on plots.

public DbSet<PlotStructureEntity> PlotStructures { get; set; }

Property Value

DbSet<PlotStructureEntity>

PlotUpdates

Plot update records.

public DbSet<PlotUpdateEntity> PlotUpdates { get; set; }

Property Value

DbSet<PlotUpdateEntity>

PlotVault

What was standing on a plot when its owner lost it.

public DbSet<PlotVaultEntity> PlotVault { get; set; }

Property Value

DbSet<PlotVaultEntity>

Plots

Ownership of authored plots of land.

public DbSet<PlotEntity> Plots { get; set; }

Property Value

DbSet<PlotEntity>

SceneServers

Scene server registry.

public DbSet<SceneServerEntity> SceneServers { get; set; }

Property Value

DbSet<SceneServerEntity>

Scenes

Scene instances.

public DbSet<SceneEntity> Scenes { get; set; }

Property Value

DbSet<SceneEntity>

Schema

Gets the database schema name for this context.

public string Schema { get; }

Property Value

string

ServerBandwidthHours

The minutes rolled up per server and hour by the Control Panel, kept 13 months. See ServerBandwidthHourEntity.

public DbSet<ServerBandwidthHourEntity> ServerBandwidthHours { get; set; }

Property Value

DbSet<ServerBandwidthHourEntity>

ServerBandwidthMinutes

What each server process sent and received, per minute, as its own transport measured it. Written by the servers; see ServerBandwidthMinuteEntity.

public DbSet<ServerBandwidthMinuteEntity> ServerBandwidthMinutes { get; set; }

Property Value

DbSet<ServerBandwidthMinuteEntity>

SmsQueue

Outbound SMS queue, shaped like EmailQueue. No provider is wired yet; the drain only logs.

public DbSet<SmsQueueEntity> SmsQueue { get; set; }

Property Value

DbSet<SmsQueueEntity>

SqlIntValues

Keyless entity set for mapping scalar integer results from raw SQL queries via FromSqlRaw.

public DbSet<SqlIntValue> SqlIntValues { get; set; }

Property Value

DbSet<SqlIntValue>

SqlLongValues

Keyless entity set for mapping scalar bigint results from raw SQL queries via FromSqlRaw.

public DbSet<SqlLongValue> SqlLongValues { get; set; }

Property Value

DbSet<SqlLongValue>

SupportTicketMessages

The messages on those tickets, replies and internal notes alike.

public DbSet<SupportTicketMessageEntity> SupportTicketMessages { get; set; }

Property Value

DbSet<SupportTicketMessageEntity>

SupportTickets

Support tickets filed by players and worked by staff.

public DbSet<SupportTicketEntity> SupportTickets { get; set; }

Property Value

DbSet<SupportTicketEntity>

TwoFactorRecoveryCodes

Two-factor recovery codes.

public DbSet<TwoFactorRecoveryCodeEntity> TwoFactorRecoveryCodes { get; set; }

Property Value

DbSet<TwoFactorRecoveryCodeEntity>

TwoFactorResetRequests

Delayed two-factor reset requests, for accounts that lost both their authenticator and their recovery codes. Completing one never satisfies two-factor by itself — see TwoFactorResetRequestEntity.

public DbSet<TwoFactorResetRequestEntity> TwoFactorResetRequests { get; set; }

Property Value

DbSet<TwoFactorResetRequestEntity>

WebSessions

Control Panel browser sessions. Separate from AuthTokens, which holds game tokens issued by a LoginServer.

public DbSet<WebSessionEntity> WebSessions { get; set; }

Property Value

DbSet<WebSessionEntity>

WorldClockControl

The one world clock row (id 1). See WorldClockControlEntity.

public DbSet<WorldClockControlEntity> WorldClockControl { get; set; }

Property Value

DbSet<WorldClockControlEntity>

WorldPortalStates

Portals opened for the whole world, per (scene, portal index).

public DbSet<WorldPortalStateEntity> WorldPortalStates { get; set; }

Property Value

DbSet<WorldPortalStateEntity>

WorldServers

World server registry.

public DbSet<WorldServerEntity> WorldServers { get; set; }

Property Value

DbSet<WorldServerEntity>

Methods

Dispose()

Releases the allocated resources for this context.

public override void Dispose()

DisposeAsync()

Releases the allocated resources for this context.

public override ValueTask DisposeAsync()

Returns

ValueTask

OnModelCreating(ModelBuilder)

Override this method to further configure the model that was discovered by convention from the entity types exposed in DbSet<TEntity> properties on your derived context. The resulting model may be cached and re-used for subsequent instances of your derived context.

protected override void OnModelCreating(ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

The builder being used to construct the model for this context. Databases (and other extensions) typically define extension methods on this object that allow you to configure aspects of the model that are specific to a given database.

Remarks

If a model is explicitly set on the options for this context (via UseModel(IModel)) then this method will not be run.

Events

Disposed

Raised when this context is disposed. Used by NpgsqlDbContextFactory to track active context count.

public event EventHandler? Disposed

Event Type

EventHandler