示例#1
0
        public void Usage()
        {
            ObjectContainer db4oContainer = (ObjectContainer)Container["db4o.container"];

            Assert.IsNotNull(db4oContainer);

            Guid id = Guid.NewGuid();

            try
            {
                db4oContainer.Set(new Beer(id));
            }
            catch
            {
                db4oContainer.Rollback();
            }
            finally
            {
                db4oContainer.Commit();
            }

            ObjectSet results = db4oContainer.Get(typeof(Beer));

            Assert.AreEqual(1, results.Size());
            Beer loaded = (Beer)results.Next();

            Assert.AreEqual(id, loaded.Id);

            db4oContainer.Delete(loaded);
            db4oContainer.Commit();

            results = db4oContainer.Get(typeof(Beer));
            Assert.AreEqual(0, results.Size());
        }
示例#2
0
 public virtual void Remove(Beer beer)
 {
     _objContainer.Delete(beer);
 }
示例#3
0
 public override void Delete(TEntity entity)
 {
     ObjectContainer.Delete(entity);
 }