Namespace FishMMO.Database
Namespaces
Classes
- AppSettings
Application settings for database connections.
- Database
Main orchestrator and facade for the FishMMO database layer. Provides centralized access to database services, health monitoring, and metrics. This class initializes the database context factory, discovers and registers concrete service implementations, and exposes monitoring points to the host application.
- DatabaseErrorCodes
Standardized error codes for database operations across all services. Use these constants instead of inline strings to ensure consistency.
- DatabaseSecrets
Secure resolver for database connection parameters.
Resolution order (first wins):
- Environment variables (FISHMMO_DB_*)
- Platform secrets file:
- Linux: /etc/fishmmo/db-secrets.env
- Windows: %ProgramData%\FishMMO\db-secrets.env
The secrets file is a simple KEY=VALUE format (one per line,
comments and blank lines ignored). On Linux it should be
chmod 600 owned by the service user.
appsettings.json MUST NOT contain Username or Password fields. Those fields have been removed from the configuration model entirely — there is no IConfiguration fallback for credentials.
- NpgsqlSettings
PostgreSQL connection settings.
- QueryPerformanceConfiguration
Configuration for tracking and logging slow database queries.
- RetryPolicyConfiguration
Configuration for handling database connection retries.
Structs
- BulkWriteResult
What a bulk write actually did, as distinct from whether it errored.
- DatabaseResult
Non-generic version of DatabaseResult for operations that don't return data.
- DatabaseResult<T>
Represents the result of a database operation with success/failure status and optional data. Type-safe alternative to tuples that provides consistent error handling across all database operations. Follows Functional Programming principles: explicit success/failure handling without exceptions for expected failures.
Interfaces
- IDatabase
Defines the contract for the database orchestrator and facade. Provides centralized access to database services, health monitoring, and metrics. Abstracts the underlying database implementation for testability and flexibility.
- IDatabaseServiceRegistry
Defines a contract for database service registries. Enables automatic service discovery, registration, and retrieval for database services. Follows Interface Segregation Principle and Open/Closed Principle for extensibility. Can be implemented for different database types (Npgsql, MongoDB, etc.).