End-User Documentation

QueryLens Facade API

QueryLens Facade API

The static QueryLens facade is the main public configuration and batch-validation surface.

Members

  • Dialect: gets or sets the active global DialectProfile
  • HasLoadedSchema: true when a schema snapshot is loaded
  • IsFrozen: true after the first validation has locked the runtime configuration
  • LoadDbSchemaFrom(string connectionString): loads a schema snapshot using the selected dialect
  • LoadDbSchemaFrom(string connectionString, DialectProfile dialect): loads a schema snapshot and selects a dialect in one call
  • LoadDbSchemaFromAsync(...): async overloads of schema loading
  • RefreshDbSchema(): reloads the current snapshot source
  • ClearDbSchema(): clears the current snapshot
  • Reset(): clears dialect, schema, and freeze state
  • ValidateAssembly(Assembly assembly): validates all discovered SQL statements in an assembly
  • RetrieveSqlStatementsFromAssembly(Assembly assembly): returns discovered statements without validating them

Example

QueryLens.Dialect = DialectProfile.SqlServer2019;
QueryLens.LoadDbSchemaFrom(connectionString);

var result = QueryLens.ValidateAssembly(typeof(OrderQueries).Assembly);
Assert.True(result.AllValid, result.Summary);

Constraints

  • Global configuration must be set before validation freezes the runtime.
  • Schema loading is currently SQL Server-backed.
  • Assembly validation uses the active global runtime level.

Related