Skip to content

Commit

Permalink
Added case in sensitive name replace
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Oct 3, 2023
1 parent a9aa6a6 commit 49f79e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public async Task SelectContainsCaseInsensitiveAsync()
var name = "NeuroSpeech.EntityAccessControl.Tests.Model.Post";

var m = System.Text.Json.JsonSerializer.Serialize(new object[] {
new object[] { "where", "x => x.PostID > @0 && @1.Contains(x.postID)", 0 , new long[] {
new object[] { "where", "x => x.PostID > @0 && @1.Contains(x.pOstID)", 0 , new long[] {
1,2,3,4
} },
new object[] {"include", "x => x.Tags" },
Expand Down
8 changes: 6 additions & 2 deletions NeuroSpeech.EntityAccessControl/Parser/MethodParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ private Task<LinqMethodDelegate<T>> ParseQuery<T>(LinqMethodOptions args, List<L
code = code.Replace(pn, $"p{finalIndex}");
code = code.Replace("CastAs.String(", "CastAs.String((int)");
}
foreach(var p in args.Names) {
code = code.Replace(p.Key, p.Value);
//foreach(var p in args.Names) {
// code = code.Replace(p.Key, p.Value);
//}
foreach (var p in args.Names)
{
code = code.Replace("." + p.Key, "." + p.Value, StringComparison.InvariantCultureIgnoreCase);
}
exec.AppendLine($".{m.Method}({code})");
}
Expand Down

0 comments on commit 49f79e7

Please sign in to comment.