コード例 #1
0
        public void SaveNewObject_SavesObject()
        {
            using (var session = _documentStore.OpenSession())
            {
                var set = new RavenObjectSet<TestClass>(session);
                set.AddObject(new TestClass() { FirstName = "Donald", LastName = "Duck" });
                session.SaveChanges();
            }

            using (var session = _documentStore.OpenSession())
            {
                TestClass duck = (from tc in session.Query<TestClass>() where tc.FirstName == "Donald" select tc).FirstOrDefault();
                Assert.That(duck, Is.Not.Null);
            }
        }
コード例 #2
0
ファイル: RavenObjectSetTests.cs プロジェクト: rbell/NeuCMS
        public void SaveNewObject_SavesObject()
        {
            using (var session = _documentStore.OpenSession())
            {
                var set = new RavenObjectSet <TestClass>(session);
                set.AddObject(new TestClass()
                {
                    FirstName = "Donald", LastName = "Duck"
                });
                session.SaveChanges();
            }

            using (var session = _documentStore.OpenSession())
            {
                TestClass duck = (from tc in session.Query <TestClass>() where tc.FirstName == "Donald" select tc).FirstOrDefault();
                Assert.That(duck, Is.Not.Null);
            }
        }