Пример #1
0
        public void ReadWrite()
        {
            decimal expected = 5.64351M;

            DecimalClass basic = new DecimalClass();

            basic.Id           = 1;
            basic.DecimalValue = expected;

            ISession s = OpenSession();

            s.Save(basic);
            s.Flush();
            s.Close();

            s     = OpenSession();
            basic = (DecimalClass)s.Load(typeof(DecimalClass), 1);

            Assert.AreEqual(expected, basic.DecimalValue);
            Assert.AreEqual(5.643510M, basic.DecimalValue);

            s.Delete(basic);
            s.Flush();
            s.Close();
        }
Пример #2
0
        public async Task ReadWriteAsync()
        {
            decimal expected = 5.64351M;

            DecimalClass basic = new DecimalClass();

            basic.Id           = 1;
            basic.DecimalValue = expected;

            ISession s = OpenSession();

            await(s.SaveAsync(basic));
            await(s.FlushAsync());
            s.Close();

            s     = OpenSession();
            basic = (DecimalClass)await(s.LoadAsync(typeof(DecimalClass), 1));

            Assert.AreEqual(expected, basic.DecimalValue);
            Assert.AreEqual(5.643510M, basic.DecimalValue);

            await(s.DeleteAsync(basic));
            await(s.FlushAsync());
            s.Close();
        }
		public void ReadWrite()
		{
			decimal expected = 5.64351M;

			DecimalClass basic = new DecimalClass();
			basic.Id = 1;
			basic.DecimalValue = expected;

			ISession s = OpenSession();
			s.Save(basic);
			s.Flush();
			s.Close();

			s = OpenSession();
			basic = (DecimalClass) s.Load(typeof(DecimalClass), 1);

			Assert.AreEqual(expected, basic.DecimalValue);
			Assert.AreEqual(5.643510M, basic.DecimalValue);

			s.Delete(basic);
			s.Flush();
			s.Close();
		}
Пример #4
0
        public void ReadWrite()
        {
            const decimal expected = 5.64351M;

            var basic = new DecimalClass
            {
                Id           = 1,
                DecimalValue = expected
            };

            using (var s = OpenSession())
            {
                s.Save(basic);
                s.Flush();
            }

            using (var s = OpenSession())
            {
                basic = s.Load <DecimalClass>(1);

                Assert.That(basic.DecimalValue, Is.EqualTo(expected));
                Assert.That(basic.DecimalValue, Is.EqualTo(5.643510M));
            }
        }
Пример #5
0
        public async Task ReadWriteAsync()
        {
            const decimal expected = 5.64351M;

            var basic = new DecimalClass
            {
                Id           = 1,
                DecimalValue = expected
            };

            using (var s = OpenSession())
            {
                await(s.SaveAsync(basic));
                await(s.FlushAsync());
            }

            using (var s = OpenSession())
            {
                basic = await(s.LoadAsync <DecimalClass>(1));

                Assert.That(basic.DecimalValue, Is.EqualTo(expected));
                Assert.That(basic.DecimalValue, Is.EqualTo(5.643510M));
            }
        }