1
我知道TimeSpan是不可变的。 我有一个包含TimeSpan字段的对象。该字段经常更新。每次我更新db中的对象时,db4o都会更新TimeSpan字段。到现在为止还挺好。
但是旧的TimeSpan结构仍然存在于数据库中,因此db会增长并增长。 如何防止db4o保存其他人?我只需要目前在这个领域持有的TimeSpan。在db4o中存储TimeSpan
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)
感谢Gamlor用于固定链接问题:) – Vagaus 2010-11-02 14:49:00
是否DateTime是否和其他结构也受到了影响?因为我的db增长和增长。只保存Ticks。 – chriszero 2010-11-12 12:30:31