Schema Snapshot Model
Schema-backed validation uses an in-memory snapshot of database metadata instead of querying the database on every validation call.
What The Snapshot Stores
- Tables
- Columns
- Nullability
- Identity flags
- Computed flags
- Default presence
- Stored procedures
- Snapshot metadata
Why It Exists
- Validation becomes deterministic across a test run.
- QueryLens avoids repeated network calls during validation.
- The runtime can surface table, column, procedure, and write-restriction errors earlier.
Refresh Behavior
Refreshing the schema rebuilds the snapshot from the original connection settings.
Example
QueryLens.Dialect = DialectProfile.SqlServer2019;
QueryLens.LoadDbSchemaFrom(connectionString);
var query = new SqlQuery("SELECT missing_column FROM dbo.customers");
Assert.False(query.IsValid);