예제 #1
0
        public void SetCurrentConnection(IConnectionStringHelper connectionStringHelper)
        {
            ConnectionCache connectionCache = GetConnectionCache(connectionStringHelper, "current");

            CurrentConnection  = connectionCache.Service;
            CurrentUserDetails = connectionCache.UserDetails;
        }
예제 #2
0
 public DbConnectionManager(IConfigurationService configurationService, ApplicationNameAndVersion appVersion, IConnectionStringHelper connectionStringHelper, ILoggingService <DbConnectionManager> loggingService, bool storeConnections = true)
 {
     _configurationService   = configurationService;
     _appVersion             = appVersion;
     _connectionStringHelper = connectionStringHelper;
     _loggingService         = loggingService;
     _storeConnections       = storeConnections;
     _dbConnections          = new ConcurrentStack <DbConnection>();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MsSql2014SnapshotServices"/> class.
        /// </summary>
        public MsSql2014SnapshotServices(
            IConnectionStringHelper connectionStringHelper,
            ISqlHelper sqlHelper)
        {
            ArgumentChecks.AssertNotNull(connectionStringHelper, nameof(connectionStringHelper));
            ArgumentChecks.AssertNotNull(sqlHelper, nameof(sqlHelper));

            this._connectionStringHelper = connectionStringHelper;
            this._sqlHelper = sqlHelper;
        }
예제 #4
0
 public QueryConnectHelper(
     IArchitectureDetector architectureDetector,
     IConnectionStringHelper connectionStringHelper,
     IDataChecker dataChecker,
     IDbConnectionFactory dbConnectionFactory,
     IExcelWriter excelWriter,
     ILog log,
     IRelationshipsDataChecker relationshipsDataChecker,
     ISharpCloudApiFactory sharpCloudApiFactory)
 {
     _architectureDetector   = architectureDetector;
     _connectionStringHelper = connectionStringHelper;
     _dataChecker            = dataChecker;
     _dbConnectionFactory    = dbConnectionFactory;
     _excelWriter            = excelWriter;
     _logger = log;
     _relationshipsDataChecker = relationshipsDataChecker;
     _sharpCloudApiFactory     = sharpCloudApiFactory;
 }
예제 #5
0
        private ConnectionCache GetConnectionCache(IConnectionStringHelper connectionStringHelper, string connectionType)
        {
            Logger.WriteLine($"Changing {connectionType} connection to {GetDetails().Username}");
            if (!_connectionCache.TryGetValue(GetDetails().Username, out ConnectionCache connectionCache))
            {
                Logger.WriteLine("Connection doesn't exist. Creating new API connection");
                connectionCache = new ConnectionCache
                {
                    Service     = new CrmService(connectionStringHelper.GetConnectionString()),
                    UserDetails = new UserDetails {
                        Username = GetDetails().Username, Password = GetDetails().Password
                    }
                };
                connectionCache.UserDetails.UserSettings = UserSettings.GetUserSettings(connectionCache.Service, GetDetails().Username);
                _connectionCache.Add(GetDetails().Username, connectionCache);
            }

            return(connectionCache);
        }
예제 #6
0
 private QueryConnectHelper CreateQueryConnectHelper(
     IArchitectureDetector architectureDetector     = null,
     IConnectionStringHelper connectionStringHelper = null,
     IDataChecker dataChecker = null,
     IDbConnectionFactory dbConnectionFactory = null,
     IExcelWriter excelWriter = null,
     ILog log = null,
     IRelationshipsDataChecker relationshipsDataChecker = null,
     ISharpCloudApiFactory sharpCloudApiFactory         = null)
 {
     return(new QueryConnectHelper(
                architectureDetector ?? Mock.Of <IArchitectureDetector>(),
                connectionStringHelper ?? Mock.Of <IConnectionStringHelper>(),
                dataChecker ?? Mock.Of <IDataChecker>(),
                dbConnectionFactory ?? Mock.Of <IDbConnectionFactory>(),
                excelWriter ?? Mock.Of <IExcelWriter>(),
                log ?? Mock.Of <ILog>(),
                relationshipsDataChecker ?? Mock.Of <IRelationshipsDataChecker>(),
                sharpCloudApiFactory ?? Mock.Of <ISharpCloudApiFactory>()));
 }
예제 #7
0
 public ConnectionHelper(IConnectionStringHelper connectionStringHelper)
 {
     this._connectionStringHelper = connectionStringHelper;
 }
예제 #8
0
 public GameControllerReadQueries(IConnectionStringHelper helper)
 {
     _connectionString = helper.ConnectionString;
 }
예제 #9
0
 public PDFRepository(IConnectionStringHelper connectionString)
 {
     _connectionString = connectionString;
 }
예제 #10
0
 public AreaQueries(IConnectionStringHelper helper)
 {
     _connectionString = helper.ConnectionString;
 }
예제 #11
0
 public SessionQueries(IConnectionStringHelper helper)
 {
     _connectionString = helper.ConnectionString;
 }
예제 #12
0
        public void SetAdminConnection(IConnectionStringHelper connectionStringHelper)
        {
            ConnectionCache connectionCache = GetConnectionCache(connectionStringHelper, "admin");

            AdminConnection = connectionCache.Service;
        }