Пример #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();
                }
            }
        }
Пример #2
0
 public void Save(Store store)
 {
     NHSessionFactory.GetCurrent().Save(store);
 }