Skip to content

Commit

Permalink
Merging 0.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Sep 23, 2019
2 parents f445aee + 95c7b3b commit 91aee39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/MongoDM/DBContextBase.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -56,6 +57,10 @@ public DBContextBase(
}

// Public properties.
public IReadOnlyCollection<IEntityModel> ChangedModelsList =>
DBCache.LoadedModels.Values
.Where(model => (model as IAuditable).IsChanged)
.ToList();
public IMongoClient Client { get; }
public IMongoDatabase Database { get; }
public IDBCache DBCache { get; }
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDM/MongoDM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Digicando.MongoDM</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.18.1</Version>
<Version>0.18.2</Version>
<Authors>Digicando Srl</Authors>
<Description>ODM framework for MongoDB</Description>
</PropertyGroup>
Expand Down

0 comments on commit 91aee39

Please sign in to comment.