Пример #1
0
        private static void MakeAndStoreTwoItemsInTwoContainers(IEmbeddedObjectContainer objectContainer,
            int seriesNumber)
        {
            var evenIndex = 2 * seriesNumber;

            var oddIndex = 1 + evenIndex;

            var fred = new Container {Name = String.Format("Fred_{0}", evenIndex)};

            var itemOne = new Item {Name = String.Format("Odd_{0}", oddIndex)};

            var itemTwo = new Item {Name = String.Format("Even_{0}", evenIndex)};

            itemOne.Container = fred;

            itemTwo.Container = fred;

            {
                objectContainer.Store(itemOne);

                objectContainer.Commit();

                var ethel = new Container {Name = String.Format("Ethel_{0}", evenIndex)};

                var oldContainer = itemTwo.Container;

                itemTwo.Container = ethel;

                if (oldContainer != fred)
                {
                    throw new Exception("No!");
                }

                if (oldContainer.Items.Count() != 1)
                {
                    throw new Exception("No");
                }

                objectContainer.Store(oldContainer);
                objectContainer.Store(itemTwo);
            }
        }
Пример #2
0
 public Task SaveChanges()
 {
     return(Task.Run(() => _container.Commit()));
 }
Пример #3
0
 public void Save(DtoLicensePlateInfo licensePlateInfo)
 {
     _db4oContainer.Store(licensePlateInfo);
     _db4oContainer.Commit();
 }
Пример #4
0
 public void CommitTransaction()
 {
     _db.Commit();
     _db.Close();
 }