예제 #1
0
        public static void RetrieveSnapshotsSequentially(IObjectContainer db)
        {
            IObjectSet    result  = db.QueryByExample(typeof(Car));
            Car           car     = (Car)result.Next();
            SensorReadout readout = car.GetHistory();

            while (readout != null)
            {
                Console.WriteLine(readout);
                readout = readout.Next;
            }
        }
예제 #2
0
        public static void RetrieveSnapshotsSequentiallyCascade()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ObjectClass(typeof(TemperatureSensorReadout))
            .CascadeOnActivate(true);
            using (IObjectContainer db = Db4oEmbedded.OpenFile(config, YapFileName))
            {
                IObjectSet    result  = db.QueryByExample(typeof(Car));
                Car           car     = (Car)result.Next();
                SensorReadout readout = car.GetHistory();
                while (readout != null)
                {
                    Console.WriteLine(readout);
                    readout = readout.Next;
                }
            }
        }