예제 #1
0
        private SessionManager GetDBConnexion()
        {
            bool   useCache = false;
            string context  = ".\\Client.config";

            //Get Connexion informations
            try
            {// Initialisation du contexte de SessionFactory
                var session = SessionFactoryProvider.Factory(
                    context,
                    useCache,
                    NHibernateConstants.ContextClasses.ThreadStaticContext);
                System.Diagnostics.Trace.WriteLine("[Bootstrap] SessionFactory successfully activated");
                return(session);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format(
                                                       "[Bootstrap] SessionFactory failed initializing database : {0}",
                                                       ex.Message));
                throw;
            }
        }