public void CanReadAndSavePerson()
        {
            factory = new SessionProvider().Factory;
            int personId;
			using (var session = factory.OpenSession())
			{
				using (var transaction = session.BeginTransaction())
				{
					var person = new Person { Name = new Name { First = "Olo", Last = "Bolus" } };
					var cat = new Cat { Name = "Filip" };
					session.Save(cat);
					session.Save(person);
					transaction.Commit();
					personId = person.Id;
				}
			}
            using (var session = factory.OpenSession())
            {
                using (session.BeginTransaction())
                {
                    var person = (from p in ((IOrderedQueryable<Person>)session.Linq<Person>()) where p.Id == personId select  p).First()  ;
                    Assert.That(person.Name.First,Is.EqualTo("Olo"));
                }
            }
        }
Beispiel #2
0
 public virtual void AddCat(Cat cat)
 {
     cat.Person = this;
     this.Cats.Add(cat);
 }