示例#1
0
			public ListScenario(ISessionFactory factory)
			{
				this.factory = factory;
				using (ISession s = factory.OpenSession())
				using (ITransaction t = s.BeginTransaction())
				{
					var entity = new Parent();
					var child = new Child();
					entity.ListChildren = new List<Child> {null, child, null};
					s.Save(entity);
					t.Commit();
				}
			}
示例#2
0
			public MapScenario(ISessionFactory factory)
			{
				this.factory = factory;
				using (ISession s = factory.OpenSession())
				using (ITransaction t = s.BeginTransaction())
				{
					var entity = new Parent();
					entity.MapChildren = new Dictionary<int, Child>
					{
						{0, null},
						{1, new Child()},
						{2, null},
					};
					s.Save(entity);
					t.Commit();
				}
			}