Skip to content

Commit

Permalink
Bug fix, Revision was not incrementing
Browse files Browse the repository at this point in the history
  • Loading branch information
rofr committed Sep 17, 2014
1 parent 077160d commit d10059d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/OrigoDB.Core.UnitTests/ModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,15 @@ public void EventDispatcherIsFilteringEventDispatcher()
Assert.IsInstanceOf<FilteringEventDispatcher>(target.EventDispatcher);
}

[Test]
public void RevisionIsIncrementedWithEachCommand()
{
var config = EngineConfiguration.Create().ForIsolatedTest();
var target = Db.For<TestModel>(config);
Assert.AreEqual(0, target.Revision);
target.AddCustomer("Homer");
Assert.AreEqual(1, target.Revision);
}

}
}
4 changes: 3 additions & 1 deletion src/OrigoDB.Core/Kernels/OptimisticKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public override object ExecuteCommand(Command command)
_synchronizer.EnterUpgrade();
command.PrepareStub(_model);
_synchronizer.EnterWrite();
return command.ExecuteStub(_model);
var result = command.ExecuteStub(_model);
_model.Revision++;
return result;
}
finally
{
Expand Down

0 comments on commit d10059d

Please sign in to comment.