Added db4o.

Added guards against most problematic areas.
This commit is contained in:
kay.one
2013-02-02 11:39:27 -08:00
parent b6a4e6c32c
commit 5dbaaee005
11 changed files with 396 additions and 6 deletions

View File

@@ -1,6 +1,10 @@
using System;
using System;
using System.Data.Common;
using System.Data.SqlServerCe;
using Db4objects.Db4o;
using Db4objects.Db4o.IO;
using Db4objects.Db4o.Internal;
using Db4objects.Db4o.Internal.Config;
using StackExchange.Profiling;
using StackExchange.Profiling.Data;
@@ -23,4 +27,23 @@ namespace NzbDrone.Core.Datastore
return connection;
}
}
public class ObjectDbSessionFactory
{
public IObjectDbSession Create(IStorage storage = null)
{
if (storage == null)
{
storage = new FileStorage();
}
var config = Db4oEmbedded.NewConfiguration();
config.File.Storage = storage;
var objectContainer = Db4oEmbedded.OpenFile(config, "nzbdrone.db4o");
return new ObjectDbSession((ObjectContainerBase)objectContainer);
}
}
}