예제 #1
0
        private static void RemoveFromCollection()
        {
            PrepareDBWithPilotGroup();
            using (IObjectContainer container = Db4oEmbedded.OpenFile(DatabaseFile))
            {
                // #example: Removing from a collection doesn't delete the collection-members
                PilotGroup group = FindGroup(container);
                Pilot      pilot = group.Pilots[0];
                group.Pilots.Remove(pilot);
                container.Store(group.Pilots);

                AssertEquals(3, AllPilots(container).Count);
                AssertEquals(2, group.Pilots.Count);
                // #end example
            }
        }
예제 #2
0
        private static void RemoveAndDelete()
        {
            PrepareDBWithPilotGroup();
            using (IObjectContainer container = Db4oEmbedded.OpenFile(DatabaseFile))
            {
                // #example: Remove and delete
                PilotGroup group = FindGroup(container);
                Pilot      pilot = group.Pilots[0];
                group.Pilots.Remove(pilot);
                container.Store(group.Pilots);
                container.Delete(pilot);

                AssertEquals(2, AllPilots(container).Count);
                AssertEquals(2, group.Pilots.Count);
                // #end example
            }
        }
예제 #3
0
 private static void ReferenceIsSetToNull()
 {
     PrepareDBWithCarAndPilot();
     using (IObjectContainer container = Db4oEmbedded.OpenFile(DatabaseFile))
     {
         // #example: Delete the pilot
         Pilot pilot = FindPilot(container);
         container.Delete(pilot);
         // #end example
     }
     using (IObjectContainer container = Db4oEmbedded.OpenFile(DatabaseFile))
     {
         // #example: Reference is null after deleting
         // Now the car's reference to the car is set to null
         Car car = FindCar(container);
         AssertEquals(null, car.Pilot);
         // #end example
     }
 }
예제 #4
0
 public Car(Pilot pilot, string name)
 {
     this.name  = name;
     this.pilot = pilot;
 }
예제 #5
0
 public Car(Pilot pilot, string name)
 {
     this.name = name;
     this.pilot = pilot;
 }