コード例 #1
0
        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"));
                }
            }
        }
コード例 #2
0
ファイル: Person.cs プロジェクト: Marceli/JQueryGridTest
 public virtual void AddCat(Cat cat)
 {
     cat.Person = this;
     this.Cats.Add(cat);
 }