DapperLib / Dapper

Dapper - a simple object mapper for .Net
https://www.learndapper.com/
Other
17.51k stars 3.68k forks source link

Add command flags to overloads #918

Open nvivo opened 6 years ago

nvivo commented 6 years ago

I have many scenarios where in order to optimize queries I generate a lot of dynamic SQL with no paramenters and use CommandFlags.NoCache. I also use some unbuffered results too.

Currently, you must replace

cnn.QueryAsync<x>(sql);

with

cnn.QueryAsync<x>(new CommandDefinition(sql, flags: CommandFlags.NoCache));

which adds some boilerplate to a simple query command.

I know it's just for convenience, but would it be possible to add CommandFlags as one of the default overload parameters to the existing commands?

NickCraver commented 4 years ago

If we're going to change signatures here for cancellation tokens and such across the board in v3, yep we should normalize this too.