public MapScenario(ISessionFactory factory) { this.factory = factory; using (ISession s = factory.OpenSession()) { using (ITransaction t = s.BeginTransaction()) { var entity = new Base(); entity.NamedChildren = new Dictionary<string, Child> { {"Child1", new Child()}, {"NullChild", null}, }; var child1 = new AnotherChild { Name = "AnotherChild1" }; var child2 = new AnotherChild { Name = "AnotherChild2" }; s.Save(child1); s.Save(child2); entity.OneToManyNamedChildren = new Dictionary<string, AnotherChild> { {"AnotherChild1" , child1}, {"AnotherChild2" , child2} }; s.Save(entity); t.Commit(); } } }
public ListScenario(ISessionFactory factory) { this.factory = factory; using (ISession s = factory.OpenSession()) { using (ITransaction t = s.BeginTransaction()) { var entity = new Base(); var child = new Child(); // null members are partially working for lists, can't have one at the end // and can't use the Count property. entity.Children = new List<Child> {null, child}; s.Save(entity); t.Commit(); } } }
public MapScenario(ISessionFactory factory) { this.factory = factory; using (ISession s = factory.OpenSession()) { using (ITransaction t = s.BeginTransaction()) { var entity = new Base(); entity.NamedChildren = new Dictionary<string, Child> { {"Child1", new Child()}, {"NullChild", null}, }; s.Save(entity); t.Commit(); } } }