Esempio n. 1
0
        protected virtual void OnFixtureSetUp()
        {
            InitializeIoC();

            _unitOfWork = UnitOfWork.Start();


            // create databases
            var sessions = new[]
            {
                UnitOfWork.GetCurrentSessionFor(typeof(DomainObjectFromDatabase1)),
                UnitOfWork.GetCurrentSessionFor(typeof(DomainObjectFromDatabase2))
            };

            for (int i = 0; i < sessions.Length; i++)
            {
                _schemas[i].Execute(false, true, false, sessions[i].Connection, null);
            }

            // insert test data and evict from session
            NHWith.Transaction(delegate {
                sessions[0].Evict(Repository <DomainObjectFromDatabase1> .Save(new DomainObjectFromDatabase1("foo")));
                sessions[1].Evict(Repository <DomainObjectFromDatabase2> .Save(new DomainObjectFromDatabase2("bar")));
            });
        }
Esempio n. 2
0
 public void MultiTesting()
 {
     TestTool.RunTasks(4, () => NHWith.Transaction(delegate {
         Get();
         FindAll_With_Paging();
         GetByCategory();
     }));
 }
Esempio n. 3
0
 public void MultiTest()
 {
     TestTool.RunTasks(4, () => NHWith.Transaction(delegate {
         FindAll();
         FindAll_Paging();
         Get();
     }));
 }
 public void ExecuteUpdateTransactonal()
 {
     NHWith.Transaction(delegate {
         ExecuteUpdate_Update();
         // ExecuteUpdate_Delete();
         ExecuteUpdate_Insert();
     }
                        );
 }
Esempio n. 5
0
 public void ThreadSafeTest()
 {
     TestTool.RunTasks(4, () => NHWith.Transaction(IsolationLevel.ReadCommitted,
                                                   delegate {
         FindAll_By_DetachedCriteria();
         FindAll_By_Example_With_Criterion();
         FindAll_By_Example();
     },
                                                   UnitOfWorkNestingOptions.CreateNewOrNestUnitOfWork));
 }
Esempio n. 6
0
 public void MultiTest()
 {
     TestTool.RunTasks(4, () => NHWith.Transaction(IsolationLevel.ReadCommitted,
                                                   delegate {
         FindAll();
         Get();
         LazyLoad();
     },
                                                   UnitOfWorkNestingOptions.CreateNewOrNestUnitOfWork));
 }
Esempio n. 7
0
        public void CanEnterCachingMode()
        {
            // 기본적으로 Caching은 False이다.
            Assert.IsFalse(NHWith.Caching.Enabled);

            // Query Caching을 가능한 영역
            using (NHWith.QueryCache()) {
                Assert.IsTrue(NHWith.Caching.Enabled);
            }
            Assert.IsFalse(NHWith.Caching.Enabled);
        }
        public void NestingTransactions()
        {
            NHWith.Transaction(() => {
                FindAll_MatchingCriteria();
                Exist_With_Criteria();

                NHWith.Transaction(() => {
                    Count_With_Criteria();
                    FindOne_With_Criterion();
                });

                DeleteAll();
            });
        }
 public void TransactionTest()
 {
     NHWith.Transaction(FindAll_MatchingCriteria);
 }