示例#1
0
        public void ReadWriteRelativeUri()
        {
            using (var s = OpenSession())
            {
                var entity = new UriClass {
                    Id = 1
                };
                entity.Url = new Uri("/", UriKind.Relative);
                s.Save(entity);
                s.Flush();
            }

            using (var s = OpenSession())
            {
                var entity = s.Get <UriClass>(1);
                Assert.That(entity.Url, Is.Not.Null);
                Assert.That(entity.Url.OriginalString, Is.EqualTo("/"));
                entity.Url = new Uri("/2010/10/nhibernate-30-cookbook.html", UriKind.Relative);
                s.Save(entity);
                s.Flush();
            }
            using (var s = OpenSession())
            {
                var entity = s.Get <UriClass>(1);
                Assert.That(entity.Url.OriginalString, Is.EqualTo("/2010/10/nhibernate-30-cookbook.html"));
                s.Delete(entity);
                s.Flush();
            }
        }
示例#2
0
		public void ReadWrite()
		{
			using (var s = OpenSession())
			{
				var entity = new UriClass { Id = 1 };
				entity.Url = new Uri("http://www.fabiomaulo.blogspot.com/");
				s.Save(entity);
				s.Flush();
			}

			using (var s = OpenSession())
			{
				var entity = s.Get<UriClass>(1);
				entity.Url.Should().Not.Be.Null();
				entity.Url.OriginalString.Should().Be("http://www.fabiomaulo.blogspot.com/");
				entity.Url = new Uri("http://fabiomaulo.blogspot.com/2010/10/nhibernate-30-cookbook.html");
				s.Save(entity);
				s.Flush();
			}
			using (var s = OpenSession())
			{
				var entity = s.Get<UriClass>(1);
				entity.Url.OriginalString.Should().Be("http://fabiomaulo.blogspot.com/2010/10/nhibernate-30-cookbook.html");
				s.Delete(entity);
				s.Flush();
			}
		}
		public void ReadWriteRelativeUri()
		{
			using (var s = OpenSession())
			{
				var entity = new UriClass { Id = 1 };
				entity.Url = new Uri("/", UriKind.Relative);
				s.Save(entity);
				s.Flush();
			}

			using (var s = OpenSession())
			{
				var entity = s.Get<UriClass>(1);
				Assert.That(entity.Url, Is.Not.Null);
				Assert.That(entity.Url.OriginalString, Is.EqualTo("/"));
				entity.Url = new Uri("/2010/10/nhibernate-30-cookbook.html", UriKind.Relative);
				s.Save(entity);
				s.Flush();
			}
			using (var s = OpenSession())
			{
				var entity = s.Get<UriClass>(1);
				Assert.That(entity.Url.OriginalString, Is.EqualTo("/2010/10/nhibernate-30-cookbook.html"));
				s.Delete(entity);
				s.Flush();
			}
		}
示例#4
0
        public void ReadWrite()
        {
            using (var s = OpenSession())
            {
                var entity = new UriClass {
                    Id = 1
                };
                entity.Url = new Uri("http://www.fabiomaulo.blogspot.com/");
                s.Save(entity);
                s.Flush();
            }

            using (var s = OpenSession())
            {
                var entity = s.Get <UriClass>(1);
                Assert.That(entity.Url, Is.Not.Null);
                Assert.That(entity.Url.OriginalString, Is.EqualTo("http://www.fabiomaulo.blogspot.com/"));
                entity.Url = new Uri("http://fabiomaulo.blogspot.com/2010/10/nhibernate-30-cookbook.html");
                s.Save(entity);
                s.Flush();
            }
            using (var s = OpenSession())
            {
                var entity = s.Get <UriClass>(1);
                Assert.That(entity.Url.OriginalString, Is.EqualTo("http://fabiomaulo.blogspot.com/2010/10/nhibernate-30-cookbook.html"));
                s.Delete(entity);
                s.Flush();
            }
        }
示例#5
0
        public async Task ReadWriteRelativeUriAsync()
        {
            using (var s = OpenSession())
            {
                var entity = new UriClass {
                    Id = 1
                };
                entity.Url = new Uri("/", UriKind.Relative);
                await(s.SaveAsync(entity));
                await(s.FlushAsync());
            }

            using (var s = OpenSession())
            {
                var entity = await(s.GetAsync <UriClass>(1));
                Assert.That(entity.Url, Is.Not.Null);
                Assert.That(entity.Url.OriginalString, Is.EqualTo("/"));
                entity.Url = new Uri("/2010/10/nhibernate-30-cookbook.html", UriKind.Relative);
                await(s.SaveAsync(entity));
                await(s.FlushAsync());
            }
            using (var s = OpenSession())
            {
                var entity = await(s.GetAsync <UriClass>(1));
                Assert.That(entity.Url.OriginalString, Is.EqualTo("/2010/10/nhibernate-30-cookbook.html"));
                await(s.DeleteAsync(entity));
                await(s.FlushAsync());
            }
        }
示例#6
0
		public void InsertNullValue()
		{
			using (ISession s = OpenSession())
			{
				var entity = new UriClass { Id = 1 };
				entity.Url = null;
				s.Save(entity);
				s.Flush();
			}

			using (ISession s = OpenSession())
			{
				var entity = s.Get<UriClass>(1);
				entity.Url.Should().Be.Null();
				s.Delete(entity);
				s.Flush();
			}
		}
		public void InsertNullValue()
		{
			using (ISession s = OpenSession())
			{
				var entity = new UriClass { Id = 1 };
				entity.Url = null;
				s.Save(entity);
				s.Flush();
			}

			using (ISession s = OpenSession())
			{
				var entity = s.Get<UriClass>(1);
				Assert.That(entity.Url, Is.Null);
				s.Delete(entity);
				s.Flush();
			}
		}
示例#8
0
        public void InsertNullValue()
        {
            using (ISession s = OpenSession())
            {
                var entity = new UriClass {
                    Id = 1
                };
                entity.Url = null;
                s.Save(entity);
                s.Flush();
            }

            using (ISession s = OpenSession())
            {
                var entity = s.Get <UriClass>(1);
                Assert.That(entity.Url, Is.Null);
                s.Delete(entity);
                s.Flush();
            }
        }
示例#9
0
        public void InsertNullValue()
        {
            using (ISession s = OpenSession())
            {
                var entity = new UriClass {
                    Id = 1
                };
                entity.Url = null;
                s.Save(entity);
                s.Flush();
            }

            using (ISession s = OpenSession())
            {
                var entity = s.Get <UriClass>(1);
                entity.Url.Should().Be.Null();
                s.Delete(entity);
                s.Flush();
            }
        }
示例#10
0
        public async Task InsertNullValueAsync()
        {
            using (ISession s = OpenSession())
            {
                var entity = new UriClass {
                    Id = 1
                };
                entity.Url = null;
                await(s.SaveAsync(entity));
                await(s.FlushAsync());
            }

            using (ISession s = OpenSession())
            {
                var entity = await(s.GetAsync <UriClass>(1));
                Assert.That(entity.Url, Is.Null);
                await(s.DeleteAsync(entity));
                await(s.FlushAsync());
            }
        }