Beispiel #1
0
        private static void CopyToNewType()
        {
            using (IObjectContainer container = Db4oEmbedded.OpenFile(DatabaseFileName))
            {
                // #example: copy the data from the old type to the new one
                IList <Human> allMammals = container.Query <Human>();
                foreach (Human oldHuman in allMammals)
                {
                    HumanNew newHuman = new HumanNew("");
                    newHuman.BodyTemperature = oldHuman.BodyTemperature;
                    newHuman.IQ   = oldHuman.IQ;
                    newHuman.Name = oldHuman.Name;

                    container.Store(newHuman);
                    container.Delete(oldHuman);
                }
                // #end example
            }
        }
Beispiel #2
0
        private static void CopyToNewType()
        {
            using (IObjectContainer container = Db4oEmbedded.OpenFile(DatabaseFileName))
            {
                // #example: copy the data from the old type to the new one
                IList<Human> allMammals = container.Query<Human>();
                foreach (Human oldHuman in allMammals)
                {
                    HumanNew newHuman = new HumanNew("");
                    newHuman.BodyTemperature = oldHuman.BodyTemperature;
                    newHuman.IQ = oldHuman.IQ;
                    newHuman.Name = oldHuman.Name;

                    container.Store(newHuman);
                    container.Delete(oldHuman);
                }
                // #end example
            }
        }