End-User Documentation

Parameter Validation Surprises

Parameter Validation Surprises

Most parameter surprises come from how QueryLens extracts parameters from SQL text before it compares them with the supplied object.

Things QueryLens Ignores On Purpose

  • Parameters inside quoted strings
  • Parameters inside comments
  • System variables beginning with @@

Things That Behave Differently

  • Positional ? placeholders
  • Extra supplied properties that can surface as QL0031

Example

var query = new SqlQuery(
    "SELECT * FROM dbo.orders WHERE order_id = @Id -- @IgnoredComment",
    validationParameters: new { Id = 42, Extra = "unused" });

Assert.Contains(query.Warnings, issue => issue.Code == "QL0031");

Related