コード例 #1
0
ファイル: Fixture.cs プロジェクト: NikGovorov/nhibernate-core
		protected override void OnSetUp()
		{
			using (var session = OpenSession())
			using (var tx = session.BeginTransaction())
			{
				var entity = new TestEntity();
				entity.Id = 1;
				entity.Name = "Test Entity";
				entity.TestPerson = new Person { Id = 1, Name = "TestUser" };
				session.Save(entity);
				
				var entity1 = new TestEntity();
				entity1.Id = 2;
				entity1.Name = "Test Entity";
				entity1.TestPerson = new Person { Id = 2, Name = "TestUser" };
				session.Save(entity1);

				tx.Commit();
			}
		}
コード例 #2
0
        protected override void OnSetUp()
        {
            using (var session = OpenSession())
                using (var tx = session.BeginTransaction())
                {
                    var entity = new TestEntity();
                    entity.Id         = 1;
                    entity.Name       = "Test Entity";
                    entity.TestPerson = new Person {
                        Id = 1, Name = "TestUser"
                    };
                    session.Save(entity);

                    var entity1 = new TestEntity();
                    entity1.Id         = 2;
                    entity1.Name       = "Test Entity";
                    entity1.TestPerson = new Person {
                        Id = 2, Name = "TestUser"
                    };
                    session.Save(entity1);

                    tx.Commit();
                }
        }