Пример #1
0
		public Pet(string name, string species, int weight, Person owner)
		{
			this.name = name;
			this.species = species;
			this.weight = weight;
			this.owner = owner;
		}
Пример #2
0
		protected override void OnSetUp()
		{
			using (ISession s = OpenSession())
			{
				using (ITransaction tx = s.BeginTransaction())
				{
					Person e1 = new Person("Joe", 10, 9);
					Person e2 = new Person("Sally", 100, 8);
					Person e3 = new Person("Tim", 20, 7); //20
					Person e4 = new Person("Fred", 40, 40);
					Person e5 = new Person("Mike", 50, 50);
					s.Save(e1);
					s.Save(e2);
					s.Save(e3);
					s.Save(e4);
					s.Save(e5);
					Pet p0 = new Pet("Fido", "Dog", 25, e1);
					Pet p1 = new Pet("Biff", "Dog", 9, e1);
					Pet p2 = new Pet("Pasha", "Dog", 25, e2);
					Pet p3 = new Pet("Lord", "Dog", 10, e2);
					Pet p4 = new Pet("Max", "Dog", 25, e3);
					Pet p5 = new Pet("Min", "Dog", 8, e3);
					s.Save(p0);
					s.Save(p1);
					s.Save(p2);
					s.Save(p3);
					s.Save(p4);
					s.Save(p5);
					tx.Commit();
				}
			}
		}