What QueryLens Is
QueryLens is a .NET library that validates raw SQL during tests so broken queries fail before application code reaches production or a live runtime path.
Who It Is For
Teams that hand-write SQL in Dapper, ADO.NET, repositories, or query registries and want fast feedback without replacing their data-access stack.
What It Validates
- Structural SQL syntax
- Dialect-specific rules and function catalogs
- Validation parameters
- Schema-backed tables, columns, stored procedures, and write restrictions
What It Does Not Do
- Execute SQL
- Replace Dapper or ADO.NET
- Prove runtime data correctness
- Replace integration tests
Example
var query = new SqlQuery("SELECT customer_id, status FROM dbo.orders WHERE order_id = @Id");
Assert.True(query.IsValid);
Dapper Example
SqlQuery can be passed directly to Dapper. You do not need to translate it to string yourself.
var sql = new SqlQuery(
"SELECT customer_id, status FROM dbo.orders WHERE order_id = @Id",
validationParameters: new { Id = 42 });
Assert.True(sql.IsValid);
var order = await connection.QuerySingleOrDefaultAsync<OrderDto>(
sql,
new { Id = 42 });