Beispiel #1
0
 public static HibernateUtils GetInstance()
 {
     if (utils == null)
     {
         utils = new HibernateUtils();
         utils.OpenSession();
     }
     return(utils);
 }
Beispiel #2
0
 public ISession OpenSession()
 {
     if (Session == null)
     {
         var myConfiguration = new Configuration();
         myConfiguration.Configure();
         mySessionFactory = myConfiguration.BuildSessionFactory();
         Session          = mySessionFactory.OpenSession();
         return(Session);
     }
     utils = this;
     return(Session);
 }
Beispiel #3
0
        public ISession OpenResetSession2(string xmlPath)
        {
            if (Session != null)
            {
                Session.Close();
                Session = null;
            }
            var myConfiguration = new Configuration();


            myConfiguration.Configure(xmlPath);
            mySessionFactory = myConfiguration.BuildSessionFactory();
            Session          = mySessionFactory.OpenSession();


            utils = this;
            return(Session);
        }