Db4o Manager

Db4oManager.cs
01using System; 02using System.Collections.Generic; 03using System.IO; 04using Db4objects.Db4o; 05using Db4objects.Db4odoc.ReportsExample.Persistent; 06 07namespace Db4objects.Db4odoc.ReportsExample.Modules 08{ 09 class Db4oManager 10 { 11 public const string DbFileName = "..//..//Data//formula1.db"; 12 public static IObjectContainer _db; 13 14 private Db4oManager() 15 { 16 } 17 // end Db4oManager 18 19 public static void FillUpDB() 20 { 21 Pilot pilot = new Pilot("Michael Schumacher", 100); 22 Db().Set(pilot); 23 pilot = new Pilot("David Barichello", 95); 24 Db().Set(pilot); 25 pilot = new Pilot("Kimi Raikkonen", 100); 26 Db().Set(pilot); 27 } 28 // end FillUpDB 29 30 public static IList<Pilot> GetAllPilots() 31 { 32 IList<Pilot> result = Db().Query<Pilot>(typeof(Pilot)); 33 return result; 34 } 35 // end GetAllPilots 36 37 public static void StoreObject(Object obj) 38 { 39 Db().Set(obj); 40 } 41 // end StoreObject 42 43 public static IObjectContainer Db() 44 { 45 if (_db == null) 46 { 47 _db = Db4oFactory.OpenFile(DbFileName); 48 } 49 return _db; 50 } 51 // end Db 52 53 public static void CloseDb() 54 { 55 if (_db != null) 56 { 57 _db.Close(); 58 } 59 } 60 // end CloseDb 61 } 62}

Db4oManager.cv
Cannot format source code in files of this type.