Ejemplo n.º 1
0
        public void ReadWrite()
        {
            using (var s = OpenSession())
            {
                var docEntity = new XDocClass {
                    Id = 1
                };
                docEntity.Document = XDocument.Parse("<MyNode>my Text</MyNode>");
                s.Save(docEntity);
                s.Flush();
            }

            using (var s = OpenSession())
            {
                var docEntity = s.Get <XDocClass>(1);
                var document = docEntity.Document;
                document.Should().Not.Be.Null();
                document.Document.Root.ToString(SaveOptions.DisableFormatting).Should().Contain("<MyNode>my Text</MyNode>");
                var xmlElement = new XElement("Pizza", new XAttribute("temp", "calda"));
                document.Document.Root.Add(xmlElement);
                s.Save(docEntity);
                s.Flush();
            }
            using (var s = OpenSession())
            {
                var docEntity = s.Get <XDocClass>(1);
                var document  = docEntity.Document;
                document.Document.Root.ToString(SaveOptions.DisableFormatting).Should().Contain("Pizza temp=\"calda\"");
                s.Delete(docEntity);
                s.Flush();
            }
        }
Ejemplo n.º 2
0
        public async Task ReadWriteAsync()
        {
            using (var s = OpenSession())
            {
                var docEntity = new XDocClass {
                    Id = 1
                };
                docEntity.Document = XDocument.Parse("<MyNode>my Text</MyNode>");
                await(s.SaveAsync(docEntity));
                await(s.FlushAsync());
            }

            using (var s = OpenSession())
            {
                var docEntity = await(s.GetAsync <XDocClass>(1));
                var document  = docEntity.Document;
                Assert.That(document, Is.Not.Null);
                Assert.That(document.Document.Root.ToString(SaveOptions.DisableFormatting), Does.Contain("<MyNode>my Text</MyNode>"));
                var xmlElement = new XElement("Pizza", new XAttribute("temp", "calda"));
                document.Document.Root.Add(xmlElement);
                await(s.SaveAsync(docEntity));
                await(s.FlushAsync());
            }
            using (var s = OpenSession())
            {
                var docEntity = await(s.GetAsync <XDocClass>(1));
                var document  = docEntity.Document;
                Assert.That(document.Document.Root.ToString(SaveOptions.DisableFormatting), Does.Contain("Pizza temp=\"calda\""));
                await(s.DeleteAsync(docEntity));
                await(s.FlushAsync());
            }
        }
Ejemplo n.º 3
0
		public void ReadWrite()
		{
			using (var s = OpenSession())
			{
				var docEntity = new XDocClass {Id = 1 };
        docEntity.Document = XDocument.Parse("<MyNode>my Text</MyNode>");
				s.Save(docEntity);
				s.Flush();
			}

			using (var s = OpenSession())
			{
				var docEntity = s.Get<XDocClass>(1);
				var document = docEntity.Document;
				document.Should().Not.Be.Null();
				document.Document.Root.ToString(SaveOptions.DisableFormatting).Should().Contain("<MyNode>my Text</MyNode>");
			  var xmlElement = new XElement("Pizza", new XAttribute("temp", "calda"));
        document.Document.Root.Add(xmlElement);
				s.Save(docEntity);
				s.Flush();
			}
			using (var s = OpenSession())
			{
				var docEntity = s.Get<XDocClass>(1);
        var document = docEntity.Document;
        document.Document.Root.ToString(SaveOptions.DisableFormatting).Should().Contain("Pizza temp=\"calda\"");
				s.Delete(docEntity);
				s.Flush();
			}
		}
Ejemplo n.º 4
0
		public void InsertNullValue()
		{
			using (ISession s = OpenSession())
			{
				var docEntity = new XDocClass { Id = 1 };
				docEntity.Document = null;
				s.Save(docEntity);
				s.Flush();
			}

			using (ISession s = OpenSession())
			{
				var docEntity = s.Get<XDocClass>(1);
				docEntity.Document.Should().Be.Null();
				s.Delete(docEntity);
				s.Flush();
			}
		}
Ejemplo n.º 5
0
        public void InsertNullValue()
        {
            using (ISession s = OpenSession())
            {
                var docEntity = new XDocClass {
                    Id = 1
                };
                docEntity.Document = null;
                s.Save(docEntity);
                s.Flush();
            }

            using (ISession s = OpenSession())
            {
                var docEntity = s.Get <XDocClass>(1);
                docEntity.Document.Should().Be.Null();
                s.Delete(docEntity);
                s.Flush();
            }
        }
Ejemplo n.º 6
0
        public async Task InsertNullValueAsync()
        {
            using (ISession s = OpenSession())
            {
                var docEntity = new XDocClass {
                    Id = 1
                };
                docEntity.Document = null;
                await(s.SaveAsync(docEntity));
                await(s.FlushAsync());
            }

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