diff --git a/MongoDB.Entities/Commands/Update.cs b/MongoDB.Entities/Commands/Update.cs index 30095a537..dd6613a58 100644 --- a/MongoDB.Entities/Commands/Update.cs +++ b/MongoDB.Entities/Commands/Update.cs @@ -315,8 +315,8 @@ public Update WithArrayFilter(string filter) options.ArrayFilters = options.ArrayFilters == null - ? new List() { def } - : options.ArrayFilters.Concat(new List { def }); + ? new[] { def } + : options.ArrayFilters.Concat(new[] { def }); return this; } diff --git a/MongoDB.Entities/Commands/UpdateAndGet.cs b/MongoDB.Entities/Commands/UpdateAndGet.cs index a0aae1746..6457607e9 100644 --- a/MongoDB.Entities/Commands/UpdateAndGet.cs +++ b/MongoDB.Entities/Commands/UpdateAndGet.cs @@ -283,8 +283,8 @@ public UpdateAndGet WithArrayFilter(string filter) options.ArrayFilters = options.ArrayFilters == null - ? new List() { def } - : options.ArrayFilters.Concat(new List { def }); + ? new[] { def } + : options.ArrayFilters.Concat(new[] { def }); return this; } diff --git a/MongoDB.Entities/Core/Watcher.cs b/MongoDB.Entities/Core/Watcher.cs index d90308566..eb91e54bd 100644 --- a/MongoDB.Entities/Core/Watcher.cs +++ b/MongoDB.Entities/Core/Watcher.cs @@ -141,7 +141,7 @@ private void Init( resume = autoResume; cancelToken = cancellation; - var ops = new List() { ChangeStreamOperationType.Invalidate }; + var ops = new List(3) { ChangeStreamOperationType.Invalidate }; if ((eventTypes & EventType.Created) != 0) ops.Add(ChangeStreamOperationType.Insert); diff --git a/MongoDB.Entities/MongoDB.Entities.csproj b/MongoDB.Entities/MongoDB.Entities.csproj index ebdbdd3dd..59d2a41bb 100644 --- a/MongoDB.Entities/MongoDB.Entities.csproj +++ b/MongoDB.Entities/MongoDB.Entities.csproj @@ -8,13 +8,14 @@ A data access library for MongoDB with an elegant api, LINQ support and built-in entity relationship management. LICENSE https://mongodb-entities.com - 20.16.0-beta4 + 20.16.0-beta5 Đĵ ΝιΓΞΗΛψΚ - added DB.InsertAsync() method - added method for deleting join collections - optimized internal performance by using lists instead of hashsets - optimized Cache<T> class -- optimized Watcher class +- optimized Watcher class +- various other minor performance optimizations MongoDB.Entities MongoDB.Entities https://github.com/dj-nitehawk/MongoDB.Entities diff --git a/MongoDB.Entities/Relationships/Many.Add.cs b/MongoDB.Entities/Relationships/Many.Add.cs index 85456eac3..8f36cfdc9 100644 --- a/MongoDB.Entities/Relationships/Many.Add.cs +++ b/MongoDB.Entities/Relationships/Many.Add.cs @@ -55,7 +55,7 @@ public Task AddAsync(IEnumerable childIDs, IClientSessionHandle session { parent.ThrowIfUnsaved(); - var models = new List>(); + var models = new List>(childIDs.Count()); foreach (var cid in childIDs) { cid.ThrowIfUnsaved();