Interface INpgsqlDbContextFactory
Combined factory interface for creating NpgsqlDbContext instances with full monitoring capabilities. Extends both IDbContextFactory for core functionality and IDbContextFactoryMonitoring for monitoring features.
public interface INpgsqlDbContextFactory : IDbContextFactory, IDisposable, IAsyncDisposable, IDbContextFactoryMonitoring
- Inherited Members
- Extension Methods
Remarks
This interface provides backwards compatibility for consumers that need both context creation and monitoring capabilities. New consumers should prefer depending on the narrower interfaces:
- IDbContextFactory - For core context creation only
- IDbContextFactoryMonitoring - For monitoring access only
Implementations must be thread-safe and create new contexts per call. DbContext instances are short-lived and should not be pooled.
Methods
ValidateSchemaAsync(CancellationToken)
Reports whether this database has applied every migration the entity model expects.
Task<SchemaValidationResult> ValidateSchemaAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<SchemaValidationResult>
What was found. Never throws.
Remarks
Exposed here so a server can check it during startup. See SchemaValidationResult for what the states mean, why this reports rather than throws, and why it does not detect model drift.