Our great sponsors
-
InterpolatedStrings
FormattableString implementation with support for concatenating strings, replace, insert, etc. Like a StringBuilder but for Interpolated Strings.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
About the regex: FormattableString already provides the underlying Format and the interpolated Arguments - so I wouldn't need a regex here. However, since net6+ there's this new StringInterpolationHandler approach that parses the interpolated strings block by block (literal by literal, argument by argument) - and this is great because it provides derived classes the chance to modify the format (or just extract extra information that can be embedded with the interpolated arguments). For anyone who is not yet using net6+ the only way to do that is using regex. So basically this library has a unified API that subtypes can override and it works identically both in net5 (using regex) and in net6+ (using handlers). By inheriting and overriding methods like AppendLiteral/AppendArgument it's possible to make some hacky usages of string interpolation - like I've done here in this other project https://github.com/Drizin/DapperQueryBuilder/
Related posts
- Dapper Simple SQL Builder (A simple SQL builder for Dapper using string interpolation)
- DapperQueryBuilder using string interpolation
- Entity Framework RawQueryBuilder (Replaces FromSqlRaw with StringBuilder-like query builder)
- 100 stars in Github - Dapper Query Builder using String Interpolation
- 100 stars in Github - Dapper Query Builder using String Interpolation