End-User Documentation

Freeze Model and Global Runtime State

Freeze Model and Global Runtime State

QueryLens uses a global runtime configuration that becomes immutable after the first validation so cached parsing and validation remain deterministic.

What Freezes

After the first validation, changing these operations throws until QueryLens.Reset():

  • QueryLens.Dialect
  • QueryLens.LoadDbSchemaFrom(...)
  • QueryLens.RefreshDbSchema()
  • QueryLens.ClearDbSchema()

Why Reset() Exists

Reset() clears dialect, schema, and freeze state so a new test fixture or scenario can configure QueryLens again from scratch.

Safe Pattern

Configure QueryLens once in test setup before any code touches IsValid, Errors, Warnings, ErrorSummary, or assembly validation.

Example

QueryLens.Dialect = DialectProfile.SqlServer2019;

var query = new SqlQuery("SELECT * FROM dbo.orders");
Assert.True(query.IsValid);
Assert.True(QueryLens.IsFrozen);

Related