Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #4
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);
            }
        }
Beispiel #5
0
 public static void RetrieveCarByPilotProtoQuery(IObjectContainer db)
 {
     IQuery query = db.Query();
     query.Constrain(typeof(Car));
     Pilot proto = new Pilot("Rubens Barrichello", 0);
     query.Descend("_pilot").Constrain(proto);
     IObjectSet result = query.Execute();
     ListResult(result);
 }
Beispiel #6
0
 public static void RetrieveAllPilotsQBE(IObjectContainer db)
 {
     Pilot proto = new Pilot(null, 0);
     IObjectSet result = db.QueryByExample(proto);
     ListResult(result);
 }