public static ISessionFactory GetFactory()
        {
            lock (Padlock)
            {
                if (_sessionFactory == null)
                {
                    try
                    {
                        string connStr = DbSettings.GetConnectionString("ConnectionString");

                        _sessionFactory = Fluently.Configure().Database(OracleClientConfiguration.Oracle10.ConnectionString(connStr))
                                          .Mappings(m => m.FluentMappings.AddFromAssemblyOf <PersonnelEntity>())
                                          .ExposeConfiguration(x => x.SetProperty("connection.release_mode", "on_close"))
                                          .BuildSessionFactory();
                    }
                    catch (Exception exc)
                    {
                        throw new Exception(string.Format("Bağlantı sağlanamadı.Detay:{0}", exc.Message + " \n" + exc.InnerException));
                    }
                }
            }

            return(_sessionFactory);
        }
Exemple #2
0
        public BaseDB()
        {
            ConnectionString = DbSettings.GetConnectionString("ConnectionString");

            Session = SessionFactory.GetFactory(ConnectionString);
        }