Beispiel #1
0
 static NHibernateHelper()
 {
     try
     {
         //          Configuration cfg = new Configuration();
         //        cfg.Configure();
         //      cfg.AddAssembly(typeof(Klub).Assembly);
         Configuration cfg = new PersistentConfigurationBuilder().GetConfiguration();
         SessionFactory = cfg.BuildSessionFactory();
     }
     catch (Exception ex)
     {
         // TODO: Use your own logging mechanism rather than Console.Error
         Console.Error.WriteLine(ex);
         throw new Exception("NHibernate initialization failed", ex);
     }
 }
 static NHibernateHelper()
 {
     try
     {
       //          Configuration cfg = new Configuration();
     //        cfg.Configure();
       //      cfg.AddAssembly(typeof(Klub).Assembly);
         Configuration cfg = new PersistentConfigurationBuilder().GetConfiguration();
         SessionFactory = cfg.BuildSessionFactory();
     }
     catch (Exception ex)
     {
         // TODO: Use your own logging mechanism rather than Console.Error
         Console.Error.WriteLine(ex);
         throw new Exception("NHibernate initialization failed", ex);
     }
 }
Beispiel #3
0
        private ISessionFactory createSessionFactory()
        {
            try
            {
                Configuration cfg = new PersistentConfigurationBuilder().GetConfiguration();

                // Configuration cfg = new Configuration();
                // cfg.Configure();
                // cfg.AddAssembly(typeof(Klub).Assembly);

                /*string configurationPath = HttpContext.Current.Server.MapPath(@"~\Models\Nhibernate\hibernate.cfg.xml");
                 * cfg.Configure(configurationPath);
                 * string employeeConfigurationFile = HttpContext.Current.Server.MapPath(@"~\Models\Nhibernate\Gimnasticar.hbm.xml");
                 * cfg.AddFile(employeeConfigurationFile);*/

                return(cfg.BuildSessionFactory());
            }
            catch (Exception ex)
            {
                // TODO: Use your own logging mechanism rather than Console.Error
                Console.Error.WriteLine(ex);
                throw new Exception("NHibernate initialization failed", ex);
            }
        }
Beispiel #4
0
        private ISessionFactory createSessionFactory()
        {
            try
            {
                 Configuration cfg = new PersistentConfigurationBuilder().GetConfiguration();

                // Configuration cfg = new Configuration();
                // cfg.Configure();
                // cfg.AddAssembly(typeof(Klub).Assembly);

                /*string configurationPath = HttpContext.Current.Server.MapPath(@"~\Models\Nhibernate\hibernate.cfg.xml");
                cfg.Configure(configurationPath);
                string employeeConfigurationFile = HttpContext.Current.Server.MapPath(@"~\Models\Nhibernate\Gimnasticar.hbm.xml");
                cfg.AddFile(employeeConfigurationFile);*/

                return cfg.BuildSessionFactory();
            }
            catch (Exception ex)
            {
                // TODO: Use your own logging mechanism rather than Console.Error
                Console.Error.WriteLine(ex);
                throw new Exception("NHibernate initialization failed", ex);
            }
        }