From a27a0c4f2751bc71e6d7fa23394b6ae25f4439eb Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 27 Mar 2026 21:04:36 +1100 Subject: [PATCH] Fix linear scan in RequiredOrder --- src/EfOrderBy/RequiredOrder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EfOrderBy/RequiredOrder.cs b/src/EfOrderBy/RequiredOrder.cs index f0b0f1a..1866265 100644 --- a/src/EfOrderBy/RequiredOrder.cs +++ b/src/EfOrderBy/RequiredOrder.cs @@ -1,18 +1,18 @@ static class RequiredOrder { - static ConcurrentBag validated = []; + static ConcurrentDictionary validated = []; public static void Validate(DbContext context) { var contextType = context.GetType(); // Only check and validate once per DbContext type - if (validated.Contains(contextType)) + if (validated.ContainsKey(contextType)) { return; } - validated.Add(contextType); + validated.TryAdd(contextType, true); // Check if this DbContext requires ordering for all entities (opt-in feature) var requireOrdering = context.GetService()