示例#1
0
        public static void CarSnapshotRollback(IObjectContainer db)
        {
            IObjectSet result = db.QueryByExample(new Car("BMW"));
            Car        car    = (Car)result.Next();

            car.Snapshot();
            db.Store(car);
            db.Rollback();
            Console.WriteLine(car);
        }
示例#2
0
        public static void CarSnapshotRollbackRefresh(IObjectContainer db)
        {
            var result = db.QueryByExample(new Car("BMW"));
            Car car    = result.Next();

            car.Snapshot();
            db.Store(car);
            db.Rollback();
            db.Ext().Refresh(car, int.MaxValue);
            Console.WriteLine(car);
        }
示例#3
0
        public static void TakeManySnapshots()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ObjectClass(typeof(Car)).CascadeOnUpdate(true);
            using (IObjectContainer db = Db4oEmbedded.OpenFile(config, YapFileName))
            {
                IObjectSet result = db.QueryByExample(typeof(Car));
                Car        car    = (Car)result.Next();
                for (int i = 0; i < 5; i++)
                {
                    car.Snapshot();
                }
                db.Store(car);
            }
        }