Пример #1
0
        public async Task SavingAndRetrievingAsync()
        {
            var entity = new Dude
            {
                BooleanValue = true
            };

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    await(s.SaveAsync(entity));
                    await(tx.CommitAsync());

                    Assert.AreEqual(true, (await(s.CreateQuery("from Dude").UniqueResultAsync <Dude>())).BooleanValue);
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    await(s.DeleteAsync(entity));
                    await(tx.CommitAsync());
                }
        }
Пример #2
0
		public void SavingAndRetrieving()
		{
			var entity = new Dude
			             	{
			             		BooleanValue = true
			             	};

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				s.Save(entity);
				tx.Commit();

				Assert.AreEqual(true, s.CreateQuery("from Dude").UniqueResult<Dude>().BooleanValue);
			}

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				s.Delete(entity);
				tx.Commit();
			}
		}
Пример #3
0
        public void SavingAndRetrieving()
        {
            var entity = new Dude
            {
                BooleanValue = true
            };

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    s.Save(entity);
                    tx.Commit();

                    Assert.AreEqual(true, s.CreateQuery("from Dude").UniqueResult <Dude>().BooleanValue);
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    s.Delete(entity);
                    tx.Commit();
                }
        }