Example #1
0
            public async Task PrepareAsync(CancellationToken cancellationToken = default(CancellationToken))
            {
                ISession     s   = tc.OpenNewSession();
                ITransaction txn = s.BeginTransaction();

                Polliwog = new Animal {
                    BodyWeight = 12, Description = "Polliwog"
                };

                Catepillar = new Animal {
                    BodyWeight = 10, Description = "Catepillar"
                };

                Frog = new Animal {
                    BodyWeight = 34, Description = "Frog"
                };

                Polliwog.Father = Frog;
                Frog.AddOffspring(Polliwog);

                Butterfly = new Animal {
                    BodyWeight = 9, Description = "Butterfly"
                };

                Catepillar.Mother = Butterfly;
                Butterfly.AddOffspring(Catepillar);

                await(s.SaveAsync(Frog, cancellationToken));
                await(s.SaveAsync(Polliwog, cancellationToken));
                await(s.SaveAsync(Butterfly, cancellationToken));
                await(s.SaveAsync(Catepillar, cancellationToken));

                var dog = new Dog {
                    BodyWeight = 200, Description = "dog"
                };

                await(s.SaveAsync(dog, cancellationToken));

                var cat = new Cat {
                    BodyWeight = 100, Description = "cat"
                };

                await(s.SaveAsync(cat, cancellationToken));

                Zoo = new Zoo {
                    Name = "Zoo"
                };
                var add = new Address {
                    City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000"
                };

                Zoo.Address = add;

                PettingZoo = new PettingZoo {
                    Name = "Petting Zoo"
                };
                var addr = new Address {
                    City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000"
                };

                PettingZoo.Address = addr;

                await(s.SaveAsync(Zoo, cancellationToken));
                await(s.SaveAsync(PettingZoo, cancellationToken));

                var joiner = new Joiner {
                    JoinedName = "joined-name", Name = "name"
                };

                await(s.SaveAsync(joiner, cancellationToken));

                var car = new Car {
                    Vin = "123c", Owner = "Kirsten"
                };

                await(s.SaveAsync(car, cancellationToken));

                var truck = new Truck {
                    Vin = "123t", Owner = "Steve"
                };

                await(s.SaveAsync(truck, cancellationToken));

                var suv = new SUV {
                    Vin = "123s", Owner = "Joe"
                };

                await(s.SaveAsync(suv, cancellationToken));

                var pickup = new Pickup {
                    Vin = "123p", Owner = "Cecelia"
                };

                await(s.SaveAsync(pickup, cancellationToken));

                var b = new BooleanLiteralEntity();

                await(s.SaveAsync(b, cancellationToken));

                await(txn.CommitAsync(cancellationToken));
                s.Close();
            }
            public void Prepare()
            {
                ISession     s   = tc.OpenNewSession();
                ITransaction txn = s.BeginTransaction();

                Polliwog = new Animal {
                    BodyWeight = 12, Description = "Polliwog"
                };

                Catepillar = new Animal {
                    BodyWeight = 10, Description = "Catepillar"
                };

                Frog = new Animal {
                    BodyWeight = 34, Description = "Frog"
                };

                Polliwog.Father = Frog;
                Frog.AddOffspring(Polliwog);

                Butterfly = new Animal {
                    BodyWeight = 9, Description = "Butterfly"
                };

                Catepillar.Mother = Butterfly;
                Butterfly.AddOffspring(Catepillar);

                s.Save(Frog);
                s.Save(Polliwog);
                s.Save(Butterfly);
                s.Save(Catepillar);

                var dog = new Dog {
                    BodyWeight = 200, Description = "dog"
                };

                s.Save(dog);

                var cat = new Cat {
                    BodyWeight = 100, Description = "cat"
                };

                s.Save(cat);

                Zoo = new Zoo {
                    Name = "Zoo"
                };
                var add = new Address {
                    City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000"
                };

                Zoo.Address = add;

                PettingZoo = new PettingZoo {
                    Name = "Petting Zoo"
                };
                var addr = new Address {
                    City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000"
                };

                PettingZoo.Address = addr;

                s.Save(Zoo);
                s.Save(PettingZoo);

                var joiner = new Joiner {
                    JoinedName = "joined-name", Name = "name"
                };

                s.Save(joiner);

                var car = new Car {
                    Vin = "123c", Owner = "Kirsten"
                };

                s.Save(car);

                var truck = new Truck {
                    Vin = "123t", Owner = "Steve"
                };

                s.Save(truck);

                var suv = new SUV {
                    Vin = "123s", Owner = "Joe"
                };

                s.Save(suv);

                var pickup = new Pickup {
                    Vin = "123p", Owner = "Cecelia"
                };

                s.Save(pickup);

                var b = new BooleanLiteralEntity();

                s.Save(b);

                txn.Commit();
                s.Close();
            }
			public void Prepare()
			{
				ISession s = tc.OpenNewSession();
				ITransaction txn = s.BeginTransaction();

				Polliwog = new Animal {BodyWeight = 12, Description = "Polliwog"};

				Catepillar = new Animal {BodyWeight = 10, Description = "Catepillar"};

				Frog = new Animal {BodyWeight = 34, Description = "Frog"};

				Polliwog.Father = Frog;
				Frog.AddOffspring(Polliwog);

				Butterfly = new Animal {BodyWeight = 9, Description = "Butterfly"};

				Catepillar.Mother = Butterfly;
				Butterfly.AddOffspring(Catepillar);

				s.Save(Frog);
				s.Save(Polliwog);
				s.Save(Butterfly);
				s.Save(Catepillar);

				var dog = new Dog {BodyWeight = 200, Description = "dog"};
				s.Save(dog);

				var cat = new Cat {BodyWeight = 100, Description = "cat"};
				s.Save(cat);

				Zoo = new Zoo {Name = "Zoo"};
				var add = new Address {City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000"};
				Zoo.Address = add;

				PettingZoo = new PettingZoo {Name = "Petting Zoo"};
				var addr = new Address {City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000"};
				PettingZoo.Address = addr;

				s.Save(Zoo);
				s.Save(PettingZoo);

				var joiner = new Joiner {JoinedName = "joined-name", Name = "name"};
				s.Save(joiner);

				var car = new Car {Vin = "123c", Owner = "Kirsten"};
				s.Save(car);

				var truck = new Truck {Vin = "123t", Owner = "Steve"};
				s.Save(truck);

				var suv = new SUV {Vin = "123s", Owner = "Joe"};
				s.Save(suv);

				var pickup = new Pickup {Vin = "123p", Owner = "Cecelia"};
				s.Save(pickup);

				var b = new BooleanLiteralEntity();
				s.Save(b);

				txn.Commit();
				s.Close();
			}