Skip to content

Commit 8a68070

Browse files
authored
Support $ as parameter prefix (#1952)
1 parent ff913be commit 8a68070

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Dapper/SqlMapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ internal static int GetListPaddingExtraCount(int count)
21082108

21092109
private static string GetInListRegex(string name, bool byPosition) => byPosition
21102110
? (@"(\?)" + Regex.Escape(name) + @"\?(?!\w)(\s+(?i)unknown(?-i))?")
2111-
: ("([?@:]" + Regex.Escape(name) + @")(?!\w)(\s+(?i)unknown(?-i))?");
2111+
: ("([?@:$]" + Regex.Escape(name) + @")(?!\w)(\s+(?i)unknown(?-i))?");
21122112

21132113
/// <summary>
21142114
/// Internal use only.
@@ -2373,14 +2373,14 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn
23732373
var list = new List<PropertyInfo>(16);
23742374
foreach (var p in parameters)
23752375
{
2376-
if (Regex.IsMatch(sql, @"[?@:]" + p.Name + @"([^\p{L}\p{N}_]+|$)", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant))
2376+
if (Regex.IsMatch(sql, @"[?@:$]" + p.Name + @"([^\p{L}\p{N}_]+|$)", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant))
23772377
list.Add(p);
23782378
}
23792379
return list;
23802380
}
23812381

23822382
// look for ? / @ / : *by itself*
2383-
private static readonly Regex smellsLikeOleDb = new(@"(?<![\p{L}\p{N}@_])[?@:](?![\p{L}\p{N}@_])", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled),
2383+
private static readonly Regex smellsLikeOleDb = new(@"(?<![\p{L}\p{N}@_])[?@:$](?![\p{L}\p{N}@_])", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled),
23842384
literalTokens = new(@"(?<![\p{L}\p{N}_])\{=([\p{L}\p{N}_]+)\}", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled),
23852385
pseudoPositional = new(@"\?([\p{L}_][\p{L}\p{N}_]*)\?", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
23862386

0 commit comments

Comments
 (0)