public void TransactionalUsageMultithread() { IWindsorContainer container = CreateConfiguredContainer(); container.AddFacility("transaction", new TransactionFacility()); container.AddComponent("blogdao", typeof(BlogDaoTransactional)); _dao = (BlogDao)container["blogdao"]; _dao.DeleteAll(); const int threadCount = 1; Thread[] threads = new Thread[threadCount]; for (int i = 0; i < threadCount; i++) { threads[i] = new Thread(new ThreadStart(ExecuteMethodUntilSignal)); threads[i].Start(); } _startEvent.Set(); Thread.CurrentThread.Join(1 * 2000); _stopEvent.Set(); }
public void FlushAndTransaction() { IWindsorContainer container = CreateConfiguredContainer(); container.AddFacility("transaction", new TransactionFacility()); container.AddComponent("blogdao", typeof(BlogDaoTransactional)); BlogDao dao = (BlogDao)container["blogdao"]; dao.CreateBlog("my blog"); IList blogs = dao.ObtainBlogs(); Assert.IsNotNull(blogs); Assert.AreEqual(1, blogs.Count); dao.DeleteAll(); blogs = dao.ObtainBlogs(); Assert.IsNotNull(blogs); Assert.AreEqual(0, blogs.Count); }