Path: redb/redb.Examples/Examples/E121_ListItemWhereIn.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Examples/Examples/E121_ListItemWhereIn.cs ---- using System.Diagnostics; using redb.Core; using redb.Examples.Models; using redb.Examples.Output; namespace redb.Examples.Examples; /// /// Query filtering by ListItem.Value using WhereIn. /// Shows how to filter objects by multiple ListItem values at once. /// Requires E114-E118 to run first. /// [ExampleMeta("E121", "ListItem - WhereIn by Value", "List", ExampleTier.Free, 121, "ListItem", "WhereIn", "Value", "Query", RelatedApis = ["IRedbQueryable.WhereIn", "RedbListItem.Value"])] public class E121_ListItemWhereIn : ExampleBase { public override async Task RunAsync(IRedbService redb) { var sw = Stopwatch.StartNew(); // Query persons where Status.Value in ["Active", "Pending"] var targetValues = new[] { "Active", "Pending", "Blocked" }; var query = redb.Query() .WhereIn(p => p.Status!.Value, targetValues) .Take(100); // Uncomment to see generated SQL: // var sql = await query.ToSqlStringAsync(); // Console.WriteLine(sql); var results = await query.ToListAsync(); sw.Stop(); if (results.Count == 0) { return Ok("E121", "ListItem - WhereIn by Value", ExampleTier.Free, sw.ElapsedMilliseconds, 0, [$"Filter: Status.Value IN [{string.Join(", ", targetValues)}]", "No matching persons found"]); } var statuses = results.Select(r => r.Props?.Status?.Value ?? "N/A").Distinct(); return Ok("E121", "ListItem - WhereIn by Value", ExampleTier.Free, sw.ElapsedMilliseconds, results.Count, [$"Filter: Status.Value IN [{string.Join(", ", targetValues)}]", $"Found statuses: {string.Join(", ", statuses)}"]); } }