Exemple #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
            }
        }
Exemple #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
            }
        }