From c4bc2bf7ee51b733fc8cfdef0ccb681f08f7de76 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Thu, 19 Sep 2019 04:20:17 +0200 Subject: [PATCH 1/2] Exposed DBContextBase.ChangedModelsList property --- src/MongoDM/DBContextBase.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/MongoDM/DBContextBase.cs b/src/MongoDM/DBContextBase.cs index 34f55c22..5b8e1f6f 100644 --- a/src/MongoDM/DBContextBase.cs +++ b/src/MongoDM/DBContextBase.cs @@ -1,4 +1,5 @@ -using Digicando.MongoDM.ProxyModels; +using Digicando.MongoDM.Models; +using Digicando.MongoDM.ProxyModels; using Digicando.MongoDM.Repositories; using Digicando.MongoDM.Serialization; using Digicando.MongoDM.Utility; @@ -56,6 +57,10 @@ public DBContextBase( } // Public properties. + public IReadOnlyCollection ChangedModelsList => + DBCache.LoadedModels.Values + .Where(model => (model as IAuditable).IsChanged) + .ToList(); public IMongoClient Client { get; } public IMongoDatabase Database { get; } public IDBCache DBCache { get; } @@ -126,9 +131,7 @@ public virtual async Task SaveChangesAsync(CancellationToken cancellationToken = //} // Commit updated models replacement. - foreach (var model in DBCache.LoadedModels.Values - .Where(model => (model as IAuditable).IsChanged) - .ToList()) + foreach (var model in ChangedModelsList) { var modelType = model.GetType().BaseType; if (ModelCollectionRepositoryMap.ContainsKey(modelType)) //can't replace if is a file From 95c7b3b561c53820fa06d4633c1918200400f173 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Mon, 23 Sep 2019 17:28:25 +0200 Subject: [PATCH 2/2] Updated version --- src/MongoDM/MongoDM.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MongoDM/MongoDM.csproj b/src/MongoDM/MongoDM.csproj index 940ab715..330a1b8f 100644 --- a/src/MongoDM/MongoDM.csproj +++ b/src/MongoDM/MongoDM.csproj @@ -5,7 +5,7 @@ true Digicando.MongoDM true - 0.18.0-dev + 0.18.2 Digicando Srl ODM framework for MongoDB