Esempio n. 1
0
        public DatasourceRepository(DbConnection dbConn, ORManager orm, IGetDatasourcesMapper getDatasourcesMapper)
        {
            _dbConn = dbConn;
            _orm    = orm;

            _getDatasourcesMapper = getDatasourcesMapper;
        }
Esempio n. 2
0
        /// <summary>
        ///		Creates and prepares a <see cref="Database"/> object that
        ///		is ready to interact with the specified database.
        /// </summary>
        /// <remarks>
        ///		WARNING: There is no support for multiple NHibernate connections.  The connection
        ///		string that is used first will be the one that is used to create the NHibernate
        ///		session factory.
        /// </remarks>
        /// <param name="connectionString">
        ///		The full connection string that can be used to connect to
        ///		the database.
        ///	</param>
        public static Database GetDbConnectionFromConnectionString(string connectionString)
        {
            Database     db;
            DbConnection dbConn;

            lock (_orManagerLocker)
            {
                if (_orManager == null)
                {
                    _orManager = new ORManager(connectionString, new Assembly[] { typeof(ConfiguredDatasource).Assembly });
                }
            }

            dbConn = new DbConnection(connectionString);
            db     = new Database(dbConn, _orManager);

            return(db);
        }