DapperLib / DapperAOT

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

Support Dapper overloads with CommandDefinition #112

Open batwad opened 6 months ago

batwad commented 6 months ago

I am using the Dapper overloads which accept a CommandDefinition because I want to pass CancellationToken, for example:

        var result = await conn.ExecuteScalarAsync<string>(new CommandDefinition("sp_CrunchNumbers",
            new
            {
                WarpFactor = 43
            },
            commandType: CommandType.StoredProcedure,
            cancellationToken: cancellationToken));

The analyzer doesn't seem to detect this usage and generate code.

If I change to the overload which takes multiple args then it does generate code, however this doesn't support CancellationToken.

        var result = await conn.ExecuteScalarAsync<string>("sp_CrunchNumbers",
            new
            {
                WarpFactor = 43
            },
            commandType: CommandType.StoredProcedure);