public void TestMappings() { using (var session = NHSessionFactory.GetCurrent()) { using (var transaction = session.BeginTransaction()) { var store = new Store(); store.Name = "MyStore"; var product = new Product(); product.Name = "UberProduct"; product.Price = 123.0; store.AddProduct(product); var employee = new Employee(); employee.FirstName = "Torkel"; employee.LastName = "Ödegaard"; store.AddEmployee(employee); session.Save(store); transaction.Commit(); } } }
public virtual void AddProduct(Product product) { product.StoresStockedIn.Add(this); Products.Add(product); }