Refresh, Clear, and Reset Runtime State
These three operations change global runtime state in different ways, so it is worth choosing the smallest one that solves your test setup problem.
Differences
RefreshDbSchema()reloads the existing schema snapshot from its original sourceClearDbSchema()removes the loaded snapshot but keeps the current dialect configurationReset()clears dialect, schema, and freeze state so configuration can start fresh
When To Use Each
- Use refresh when the database schema changed and the connection target is still correct.
- Use clear when you want to keep the dialect but remove Level 3 validation.
- Use reset when the whole runtime configuration must change.
Example
QueryLens.Dialect = DialectProfile.SqlServer2019;
QueryLens.LoadDbSchemaFrom(connectionString);
QueryLens.RefreshDbSchema();
QueryLens.ClearDbSchema();
QueryLens.Reset();