DapperLib / DapperAOT

Build time tools in the flavor of Dapper
Other
349 stars 19 forks source link

[DAP226] False positive: DATEADD #80

Closed dotTrench closed 8 months ago

dotTrench commented 8 months ago

Describe the bug When using SqlConnection and querying data using the built-in MSSQL-function DATEADD parameter datepart is falsely identified as a table column causing a false DAP226 warning when used in a query with joins.

Dapper.Advisor: 1.0.10

To Reproduce

// DAP226: FROM expressions with multiple elements should qualify all columns; it is unclear where 'YEAR' is located
public static async Task DateAddWithJoin(SqlConnection connection) =>
    await connection.QueryAsync(
        """
        SELECT DATEADD(YEAR, 1, t.Year) AS NextYear
        FROM MyTable t
        JOIN MyOtherTable o ON o.Id = t.Id
        """
    );
mgravell commented 8 months ago

Fair. Should be a very simple fix! Will look tomorrow

mgravell commented 8 months ago

https://github.com/DapperLib/DapperAOT/releases/tag/1.0.16