Exemple #1
0
        public void AddAPartner()
        {
            Person john;
            using (var session = OpenSession())
            {
                john = session.Get<Person>(nicePersonId);
                Assert.IsNull(john.Partner);
                var jane = new Person("Jane") {  NickName = "John's Wife" };
                session.Save(jane);
                john.Partner = jane;
                session.Flush();
                session.Clear();

                john = session.Get<Person>(nicePersonId);
                Assert.IsNotNull(john.Partner);
                Assert.AreEqual("Jane", john.Partner.Name);

            }
            using (var session = OpenSession())
            {
                john = session.Get<Person>(nicePersonId);
                Assert.IsNotNull(john.Partner);
                Assert.AreEqual("Jane", john.Partner.Name);
            }
        }
Exemple #2
0
        protected override void OnSetUp()
        {
            using (ISession session = OpenSession())
            {
                var nicePerson = new Person("John");
                session.Save(nicePerson);

                session.Flush();
                nicePersonId = nicePerson.Id;
                session.Clear();
            }
            base.OnSetUp();
        }
Exemple #3
0
 public Cat(Person master)
     : this()
 {
     this.master = master;
 }