End-User Documentation

Assembly Validation Does Not Find My SQL

Assembly Validation Does Not Find My SQL

When discovery misses a statement, the cause is usually member visibility, member shape, or the difference between wrappers and annotated strings.

Discovery Requirements

  • Only public exported types are scanned
  • Only public static members are discovered automatically
  • Annotated members must be fields, properties, or parameterless methods

Common Mistakes

  • Keeping SQL in private or instance members
  • Using unsupported method signatures
  • Assuming non-exported types are scanned

Example

public static class OrderQueries
{
    [SqlQuery]
    public static string GetOpenOrders => "SELECT * FROM dbo.orders WHERE status = 'Open'";
}

Related