Redeon.SuperSiteEngineCore.Web.Eltheon.Core.DataProvider
Overview
This package provides the canonical Eltheon DataProvider v3 foundation. It contains the shared EF Core base contexts, provider/profile registries, migration-status contracts, DataProviderAdmin adapters, and EF activity diagnostics used by template hosts and feature packages.
Template hosts own the concrete runtime DbContexts, connection topology, and provider-specific migration assemblies. Feature packages consume the v3 contracts instead of reading legacy GlobalConfig state directly.
DataProvider v3 Model
- Hosts register runtime DbContext descriptors through
DataProviderAdminDbContextDescriptorso DataProviderAdmin can inspect only approved contexts. - Hosts expose migration status through
IDataProviderAdminMigrationStatusProvider, usually by adapting the template migration operations service. - Provider-specific migrations stay in provider-specific assemblies. This package provides status and resolution infrastructure, not template migration files.
- Legacy
GlobalConfigaccess remains compatibility plumbing for existing bootstrap and design-time paths, but new runtime code should use the v3 connection, binding, and migration contracts.
Admin Diagnostics
DataProviderAdmin uses this package to show:
- configured runtime connections with sensitive values redacted,
- registered DbContext bindings and health status,
- v3 migration status per provider/context pair,
- safe read-only data browser metadata and rows for whitelisted contexts,
- EF command, save, and connection activity snapshots.
The admin feature owns the API and UI surface; this package owns the neutral DataProvider contracts and metrics infrastructure.
Metrics And EF Activity
With an IMetrics implementation registered, DataProvider contexts emit low-cardinality metrics through the neutral Core.Abstractions metrics facade:
- Saves:
eltheon_db_save_duration_seconds,eltheon_db_save_total,eltheon_db_context_save_duration_seconds,eltheon_db_context_save_total. - Commands:
eltheon_db_command_duration_seconds,eltheon_db_command_total,eltheon_db_context_command_duration_seconds,eltheon_db_context_command_total. - Failures and slow commands:
eltheon_db_command_failures_total,eltheon_db_command_timeouts_total,eltheon_db_slow_query_total. - Connections:
eltheon_db_connection_open_duration_seconds,eltheon_db_connection_open_total,eltheon_db_connection_failures_total,eltheon_db_connection_active_estimate.
Labels are limited to low-cardinality provider/context/operation/outcome values such as db_type, context, operation, outcome, execute_method, and command_type.
IDataProviderEfActivityDiagnostics stores recent sanitized EF command, save, and connection samples in memory. MetricsDbCommandInterceptor, MetricsDbConnectionInterceptor, and the base context SaveChanges overrides feed this diagnostics store so admin dashboards can show real activity windows without coupling to a concrete metrics exporter.
Usage
Register the v3 infrastructure from the host composition layer:
services.AddEltheonDataProviderV3(options =>
{
// Host-owned provider, connection, binding, and migration options.
});
services.AddEltheonDataProviderMetrics();
Register host-owned DbContext descriptors and migration adapters from the template or application package, not from feature packages.
Database Recovery
IEltheonDatabaseRecoveryService dispatches recovery operations through provider adapters selected from the resolved logical connection. Recovery results expose only provider, status, and stable reason codes; connection strings, credentials, executable output, and physical artifact paths are never returned.
- SQLite uses the native online backup API and
PRAGMA integrity_check. - Microsoft SQL Server uses
BACKUP DATABASE ... WITH CHECKSUM,RESTORE VERIFYONLY, and a same-database restore. The SQL Server service account must be able to access the protected artifact directory supplied by the plugin operation. - MySQL uses
mysqldumpandmysql. Both tools must be installed or configured with absolute paths. Verification restores the dump into an isolated temporary database before the update may continue.
Provider recovery can be configured through EltheonDataProviderOptions.Recovery:
services.AddEltheonDataProviderV3(options =>
{
options.Recovery.SqlServer.Enabled = true;
options.Recovery.SqlServer.CommandTimeoutSeconds = 300;
options.Recovery.MySql.Enabled = true;
options.Recovery.MySql.DumpExecutablePath = "mysqldump";
options.Recovery.MySql.ClientExecutablePath = "mysql";
options.Recovery.MySql.CommandTimeoutSeconds = 300;
});
Missing tools, invalid connection metadata, unavailable backup paths, insufficient provider permissions, failed verification, and timeouts remain fail-closed before plugin database migration execution.
Recovery artifacts can be deleted through IEltheonDatabaseRecoveryService.DeleteBackupAsync only after the owning lifecycle or pruning transaction has completed. Deletion is recovery-id scoped and never exposes or accepts database credentials.