This project is read-only.

Dirty Cache (SOLVED)

Mar 21, 2013 at 7:09 PM
I've noticed that ndatabase seems to be caching items in memory and its pretty easy to make the cache go out of sync.
 //store model with name='Name'
 _testModel.Name ="Name";

//Check that it is stored correctly

//Update the instance in memory without calling store
_testModel.Name = "New Name";

//Get the object from db again, should have the last stored name
is there a way to disable this cache or force the db to bypass it?
Mar 22, 2013 at 9:03 AM
nope, there is no possibility to disable cache (it is used to find where you are using update and where you are inserting new object).

The recommended work is to have UnitOfWork entities, everyone surrounded with using so you are committing and next time you are using fresh cache. In your case, that will solve the problem with long running cache.

Mar 22, 2013 at 7:51 PM
Whats the recommended way of creating a new unit of work?
Mar 24, 2013 at 9:57 AM
If you follow Unit of Work pattern, then you have a recommended way.

There is no special way for NDatabase, that's rather common way of creating access units for your domain, so every method describing your actions will contain using declaration to open and finally close the NDatabase.