예제 #1
0
        public async Task SavingAndRetrievingTestAsync()
        {
            DateTimeOffset NowOS = DateTimeOffset.Now;

            AllDates dates = new AllDates {
                Sql_datetimeoffset = NowOS
            };

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

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = await(s.CreateQuery("from AllDates").UniqueResultAsync <AllDates>());
                    Assert.That(datesRecovered.Sql_datetimeoffset, Is.EqualTo(NowOS));
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = await(s.CreateQuery("from AllDates").UniqueResultAsync <AllDates>());
                    await(s.DeleteAsync(datesRecovered));
                    await(tx.CommitAsync());
                }
        }
예제 #2
0
        protected void SavingAndRetrievingAction(AllDates entity, Action <AllDates> action)
        {
            AllDates dates = entity;

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

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = s.CreateQuery("from AllDates").UniqueResult <AllDates>();

                    action.Invoke(datesRecovered);
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = s.CreateQuery("from AllDates").UniqueResult <AllDates>();
                    s.Delete(datesRecovered);
                    tx.Commit();
                }
        }
예제 #3
0
        public void SavingAndRetrievingTest()
        {
            var NowOS = DateTimeOffsetType.Round(DateTimeOffset.Now, DateAccuracyInTicks);

            AllDates dates = new AllDates {
                Sql_datetimeoffset = NowOS
            };

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

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = s.CreateQuery("from AllDates").UniqueResult <AllDates>();
                    Assert.That(datesRecovered.Sql_datetimeoffset, Is.EqualTo(NowOS));
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = s.CreateQuery("from AllDates").UniqueResult <AllDates>();
                    s.Delete(datesRecovered);
                    tx.Commit();
                }
        }
예제 #4
0
		protected void SavingAndRetrievingAction(AllDates entity, Action<AllDates> action)
		{
			AllDates dates = entity;

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

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>();

				action.Invoke(datesRecovered);
			}

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>();
				s.Delete(datesRecovered);
				tx.Commit();
			}
		}
		public void SavingAndRetrievingTest()
		{
			DateTimeOffset NowOS = DateTimeOffset.Now;

			AllDates dates = new AllDates { Sql_datetimeoffset = NowOS };

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

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>();
				Assert.That(datesRecovered.Sql_datetimeoffset, Is.EqualTo(NowOS));
			}

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>();
				s.Delete(datesRecovered);
				tx.Commit();
			}
		}
예제 #6
0
        public void SavingAndRetrievingTest()
        {
            DateTimeOffset NowOS = DateTimeOffset.Now;

            AllDates dates = new AllDates {
                Sql_datetimeoffset = NowOS
            };

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

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = s.CreateQuery("from AllDates").UniqueResult <AllDates>();
                    datesRecovered.Sql_datetimeoffset.Should().Be(NowOS);
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = s.CreateQuery("from AllDates").UniqueResult <AllDates>();
                    s.Delete(datesRecovered);
                    tx.Commit();
                }
        }
예제 #7
0
        protected async Task SavingAndRetrievingActionAsync(AllDates entity, Action <AllDates> action, CancellationToken cancellationToken = default(CancellationToken))
        {
            AllDates dates = entity;

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    await(s.SaveAsync(dates, cancellationToken));
                    await(tx.CommitAsync(cancellationToken));
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = await(s.CreateQuery("from AllDates").UniqueResultAsync <AllDates>(cancellationToken));

                    action.Invoke(datesRecovered);
                }

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    var datesRecovered = await(s.CreateQuery("from AllDates").UniqueResultAsync <AllDates>(cancellationToken));
                    await(s.DeleteAsync(datesRecovered, cancellationToken));
                    await(tx.CommitAsync(cancellationToken));
                }
        }
		protected override void OnSetUp()
		{
			base.OnSetUp();

			var dates1 = new AllDates { Sql_datetimeoffset = new DateTimeOffset(2012, 11, 1, 1, 0, 0, TimeSpan.FromHours(1)) };
			var dates2 = new AllDates { Sql_datetimeoffset = new DateTimeOffset(2012, 11, 1, 2, 0, 0, TimeSpan.FromHours(3)) };

			using (ISession s = OpenSession())
			using (ITransaction tx = s.BeginTransaction())
			{
				s.Save(dates1);
				s.Save(dates2);
				tx.Commit();
			}
		}
예제 #9
0
        protected override void OnSetUp()
        {
            base.OnSetUp();

            var dates1 = new AllDates {
                Sql_datetimeoffset = new DateTimeOffset(2012, 11, 1, 1, 0, 0, TimeSpan.FromHours(1))
            };
            var dates2 = new AllDates {
                Sql_datetimeoffset = new DateTimeOffset(2012, 11, 1, 2, 0, 0, TimeSpan.FromHours(3))
            };

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    s.Save(dates1);
                    s.Save(dates2);
                    tx.Commit();
                }
        }