Exemplo n.º 1
0
        public void ChangeTheNameOfTheNewtoyToBoringToy()
        {
            Toy newToy;
            using (var session = OpenSession())
            {
                var john = session.Get<Person>(nicePersonId);
                var johnJunior = new Child("John Junior", john) { NickName = "John's FirstBorn" };
                john.AddChild(johnJunior);

                newToy = new Toy(johnJunior) { Name = "New Toy Of The Day" };
                johnJunior.AddToy(newToy);

                session.Flush();
                session.Clear();
            }

            using (var session = OpenSession())
            {
                newToy = session.Get<Toy>(newToy.Id);
                newToy.Name = "Boring toy";
                session.Flush();
            }
        }
Exemplo n.º 2
0
 public virtual void AddToy(Toy newToy)
 {
     toys.Add(newToy);
 }