Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Enhance literal tokens capabilities

Open echofool opened this issue 3 years ago • 1 comments

Enhance Literal Tokens capabilities, now we can use Literal Tokens as a suffix of table for Table Sharding. before:

connection.Query("select * from User_34 where Id= {=Id}", new { Id = 5201314 });

after:

connection.Query("select * from User_{=TableId} where Id= {=Id}", new { TableId = 5201314%64 , Id = 5201314 });

echofool avatar Dec 17 '21 07:12 echofool

This is an interesting one. I'm always a little twitchy when it comes to SQL rewriting, but: the existing feature exists. What I'd really like to remember (and can't) is what scenarios the existing prefix exclusion was there to care about. Sadly there are no tests for that. It is also interesting that we don't seem to care about any similar exclusion after the token.

In principle, I'm fine with this. I just want to try to think of edge conditions where we need to care more about what comes before (or possibly after?)

mgravell avatar Dec 18 '21 09:12 mgravell