Skip to content

Commit 3ffe75a

Browse files
updates
1 parent 4a1b072 commit 3ffe75a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Magic.IndexedDb/LinqTranslation/Extensions/UniversalExpressionBuilder.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ void HandleNot(Expression inner, bool isInOr)
8989
ExpressionType.LessThan => "GreaterThanOrEqual",
9090
ExpressionType.GreaterThanOrEqual => "LessThan",
9191
ExpressionType.LessThanOrEqual => "GreaterThan",
92+
ExpressionType.Equal => "NotEquals",
93+
ExpressionType.NotEqual => "StringEquals", // treat double negation of != as normal ==
9294
_ => throw new InvalidOperationException($"Unsupported NOT binary: {bin}")
9395
};
96+
9497
AddConditionInternal(bin.Left as MemberExpression, ToConst(bin.Right), op, isInOr);
9598
break;
9699

TestWasm/Pages/Home.razor

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@using Magic.IndexedDb.Testing.Models
66
@using TestWasm.Models
77
@using TestWasm.Repository
8+
@using System.Linq;
89

910
@inject IMagicIndexedDb _MagicDb
1011

@@ -274,8 +275,20 @@
274275
var d = new DateTime();
275276
var asdf = d.DayOfWeek;
276277
var asdf2 = d.DayOfYear;
277-
// RunTest("Date Year Test", await personQuery.Where(x => x.DateOfBirth.Value.Year >= 2020).ToListAsync(),
278-
// allPeople.Where(x => x.DateOfBirth.HasValue && x.DateOfBirth.Value.Year == 2020));
278+
// RunTest("Date Year Test", await personQuery.Where(x => x.DateOfBirth.Value.Year >= 2020).ToListAsync(),
279+
// allPeople.Where(x => x.DateOfBirth.HasValue && x.DateOfBirth.Value.Year == 2020));
280+
281+
282+
RunTest("Ends With Test", await personQuery.Where(x => x.Name.EndsWith("ack")).ToListAsync(),
283+
allPeople.Where(x => x.Name.EndsWith("ack")));
284+
285+
RunTest("Ends With Negative Test", await personQuery.Where(x => !x.Name.EndsWith("ack")).ToListAsync(),
286+
allPeople.Where(x => !x.Name.EndsWith("ack")));
287+
288+
int[] myArray = { 38, 39 };
289+
290+
RunTest("Contains Test", await personQuery.Where(x => myArray.Contains(x._Age)).ToListAsync(),
291+
allPeople.Where(x => myArray.Contains(x._Age)));
279292

280293
RunTest("Combined Query Test", await personQuery.Where(x => x.Name == "Zack" && x.TestIntStable2 == 10).ToListAsync(),
281294
allPeople.Where(x => x.Name == "Zack" && x.TestIntStable2 == 10));

0 commit comments

Comments
 (0)