Validation Levels
QueryLens applies progressively stricter validation as you add configuration: generic syntax first, then dialect rules, then schema-backed checks.
Levels
- Level 1 is the default and focuses on structurally broken SQL while staying permissive across dialect families.
- Level 2 starts when
QueryLens.Dialectis set and adds function catalogs, reserved words, and version-aware syntax rules. - Level 3 starts when a schema snapshot is loaded and adds table, column, stored procedure, identity, computed-column, and required-column checks.
Mental Model
The same query can pass Level 1, fail Level 2 because of a dialect rule, or fail Level 3 because the schema says an object is missing.
Example
var query = new SqlQuery("SELECT STRING_AGG(name, ',') FROM departments");
Assert.True(query.IsValid);
QueryLens.Reset();
QueryLens.Dialect = DialectProfile.SqlServer2017;
Assert.True(new SqlQuery("SELECT STRING_AGG(name, ',') FROM departments").IsValid);