Example #1
0
        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();
                }
            }
        }
Example #2
0
 public virtual void AddEmployee(Employee employee)
 {
     employee.Store = this;
     Staff.Add(employee);
 }
Example #3
0
 public void Save(Employee store)
 {
     NHSessionFactory.GetCurrent().Save(store);
 }