Esempio n. 1
0
 protected override void OnSetUp()
 {
     using (var session = OpenSession())
         using (var tran = session.BeginTransaction())
         {
             var personWithAllTypes = new PersonWithAllTypes();
             var animal             = new Animal {
                 Name = "Pasha", Owner = personWithAllTypes
             };
             var dog = new Dog {
                 Country = "Turkey", Name = "Kral", Owner = personWithAllTypes
             };
             var sivasKangal = new SivasKangal
             {
                 Name         = "Karabas",
                 Country      = "Turkey",
                 HouseAddress = "Address",
                 Owner        = personWithAllTypes
             };
             var cat = new Cat {
                 Name = "Tekir", EyeColor = "Red", Owner = personWithAllTypes
             };
             personWithAllTypes.AnimalsGeneric.Add(animal);
             personWithAllTypes.AnimalsGeneric.Add(cat);
             personWithAllTypes.AnimalsGeneric.Add(dog);
             personWithAllTypes.AnimalsGeneric.Add(sivasKangal);
             _personId = session.Save(personWithAllTypes);
             tran.Commit();
         }
 }
Esempio n. 2
0
		protected override void OnSetUp()
		{
			using (var session = OpenSession())
			using (var tran = session.BeginTransaction())
			{
				PersonWithAllTypes personWithAllTypes = new PersonWithAllTypes();
				Animal animal = new Animal { Name = "Pasha", Owner = personWithAllTypes };
				Dog dog = new Dog { Country = "Turkey", Name = "Kral", Owner = personWithAllTypes };
				SivasKangal sivasKangal = new SivasKangal
				                          	{
				                          		Name = "Karabas",
				                          		Country = "Turkey",
				                          		HouseAddress = "Address",
				                          		Owner = personWithAllTypes
				                          	};
				Cat cat = new Cat { Name = "Tekir", EyeColor = "Red", Owner = personWithAllTypes };
				personWithAllTypes.AnimalsGeneric.Add(animal);
				personWithAllTypes.AnimalsGeneric.Add(cat);
				personWithAllTypes.AnimalsGeneric.Add(dog);
				personWithAllTypes.AnimalsGeneric.Add(sivasKangal);
				session.Save(personWithAllTypes);
				tran.Commit();
			}
		}