Пример #1
0
 public static void StoreFirstCar(IObjectContainer db)
 {
     Car car1 = new Car("Ferrari");
     Pilot pilot1 = new Pilot("Michael Schumacher", 100);
     car1.Pilot = pilot1;
     db.Store(car1);
 }
Пример #2
0
 public static void RetrieveCarByPilotQBE(IObjectContainer db)
 {
     Pilot pilotproto = new Pilot("Rubens Barrichello", 0);
     Car carproto = new Car(null);
     carproto.Pilot = pilotproto;
     IObjectSet result = db.QueryByExample(carproto);
     ListResult(result);
 }
Пример #3
0
 public static void StoreSecondCar(IObjectContainer db)
 {
     Pilot pilot2 = new Pilot("Rubens Barrichello", 99);
     db.Store(pilot2);
     Car car2 = new Car("BMW");
     car2.Pilot = pilot2;
     db.Store(car2);
 }
Пример #4
0
 public static void RetrieveAllCarsQBE(IObjectContainer db)
 {
     Car proto = new Car(null);
     IObjectSet result = db.QueryByExample(proto);
     ListResult(result);
 }
Пример #5
0
 public static void DeleteDeepRevisited()
 {
     IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();
     config.Common.ObjectClass(typeof(Car)).CascadeOnDelete(true);
     using(IObjectContainer db = Db4oEmbedded.OpenFile(config, YapFileName))
     {
         IObjectSet result = db.QueryByExample(new Pilot("Michael Schumacher", 0));
         Pilot pilot = (Pilot)result.Next();
         Car car1 = new Car("Ferrari");
         Car car2 = new Car("BMW");
         car1.Pilot = pilot;
         car2.Pilot = pilot;
         db.Store(car1);
         db.Store(car2);
         db.Delete(car2);
         result = db.QueryByExample(new Car(null));
         ListResult(result);
     }
 }
Пример #6
0
 public bool Match(Car candidate)
 {
     return candidate.Pilot.Name == _pilotName;
 }