I know that TimeSpan's are immutable.
I have a object which contains a TimeSpan field. This field is updated frequently. Every time I update the object in the db, db4o updates the TimeSpan field. So far, so good.
But the old TimeSpan structs are remaining in the db, so the db grows and grows.
How can I prevent db4o for saving the others? I only need the TimeSpan currently held in this field.
class Test {
TimeSpan _totalRuntime;
void Work() {
DateTime start = DateTime.Now;
_totalRuntime = _totalRuntime.Add(DateTime.Now - start);
}
}
// Open the db
IObjectContainer db = Db4oEmbedded.OpenFile(ConfigDb4O(), _db4OFilename);
public static IEmbeddedConfiguration ConfigDb4O() {
IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();
config.Common.Diagnostic.AddListener(new DiagnosticToConsole());
return config;
}
db4o 7.12.132.14217 (.NET20)