Esempio n. 1
0
        protected override void OnSetUp()
        {
            base.OnSetUp();

            using (ISession session = OpenSession())
                using (ITransaction tx = session.BeginTransaction())
                {
                    // Insert a bunch of AbcThings
                    numAbcThings   = 5;
                    this.abcThings = new AbcThing[numAbcThings];
                    for (int i = 0; i < numAbcThings; i++)
                    {
                        AbcThing newAbcThing = new AbcThing();
                        // AbcThing.ClassType is automatically generated.
                        newAbcThing.ID   = Utils.GetRandomID();
                        newAbcThing.Name = newAbcThing.ID;
                        session.Save(newAbcThing);
                    }

                    // Insert a bunch of OtherThings
                    numOtherThings   = 5;
                    this.otherThings = new OtherThing[numOtherThings];
                    for (int i = 0; i < numOtherThings; i++)
                    {
                        OtherThing newOtherThing = new OtherThing();
                        // OtherThing.ClassType is automatically generated.
                        newOtherThing.ID   = Utils.GetRandomID();
                        newOtherThing.Name = newOtherThing.ID;
                        session.Save(newOtherThing);
                    }

                    tx.Commit();
                }
        }
Esempio n. 2
0
		protected override void OnSetUp()
		{
			base.OnSetUp();

			using (ISession session = OpenSession())
			using (ITransaction tx = session.BeginTransaction())
			{
				// Insert a bunch of AbcThings
				numAbcThings = 5;
				this.abcThings = new AbcThing[numAbcThings];
				for (int i = 0; i < numAbcThings; i++)
				{
					AbcThing newAbcThing = new AbcThing();
					// AbcThing.ClassType is automatically generated.
					newAbcThing.ID = Utils.GetRandomID();
					newAbcThing.Name = newAbcThing.ID;
					session.Save(newAbcThing);
				}

				// Insert a bunch of OtherThings
				numOtherThings = 5;
				this.otherThings = new OtherThing[numOtherThings];
				for (int i = 0; i < numOtherThings; i++)
				{
					OtherThing newOtherThing = new OtherThing();
					// OtherThing.ClassType is automatically generated.
					newOtherThing.ID = Utils.GetRandomID();
					newOtherThing.Name = newOtherThing.ID;
					session.Save(newOtherThing);
				}

				tx.Commit();
			}
		}