Example #1
0
 private static void StoreObject()
 {
     // #example: Store an object
     using (IObjectContainer container = Db4oEmbedded.OpenFile("databaseFile.db4o"))
     {
         Pilot pilot = new Pilot("Joe");
         container.Store(pilot);
     }
     // #end example
 }
Example #2
0
        private static void AllOperationsInOnGo()
        {
            // #example: The basic operations
            using (IObjectContainer container = Db4oEmbedded.OpenFile("databaseFile.db4o"))
            {
                // store a new pilot
                Pilot pilot = new Pilot("Joe");
                container.Store(pilot);

                // query for pilots
                var pilots = from Pilot p in container
                             where p.Name.StartsWith("Jo")
                             select p;

                // update pilot
                Pilot toUpdate = pilots.First();
                toUpdate.Name = "New Name";
                container.Store(toUpdate);

                // delete pilot
                container.Delete(toUpdate);
            }
            // #end example
        }
Example #3
0
        private static void AllOperationsInOnGo()
        {
            // #example: The basic operations
            using(IObjectContainer container = Db4oEmbedded.OpenFile("databaseFile.db4o"))
            {
                // store a new pilot
                Pilot pilot = new Pilot("Joe");
                container.Store(pilot);

                // query for pilots
                var pilots = from Pilot p in container
                             where p.Name.StartsWith("Jo")
                             select p;

                // update pilot
                Pilot toUpdate = pilots.First();
                toUpdate.Name = "New Name";
                container.Store(toUpdate);

                // delete pilot
                container.Delete(toUpdate);
            } 
            // #end example
        }