Example #1
0
 /// <summary>
 /// Establishes connection to the SMM GSM database.
 /// </summary>
 private void EstablishConnnection()
 {
     _globalConnection = new SqlStoreConnection(
         StoreConnectionKind.Global,
         _credentials.ConnectionInfoShardMapManager);
     _globalConnection.Open();
 }
Example #2
0
        /// <summary>
        /// Establishes connection to the target shard.
        /// </summary>
        private void EstablishConnnection()
        {
            // Open connection.
            SqlConnectionStringBuilder localConnectionString =
                new SqlConnectionStringBuilder(_credentials.ConnectionStringShard)
            {
                DataSource     = this.Location.DataSource,
                InitialCatalog = this.Location.Database
            };

            _localConnection = new SqlStoreConnection(StoreConnectionKind.LocalSource, localConnectionString.ConnectionString);
            _localConnection.Open();
        }
        /// <summary>
        /// Establishes connection to the target shard.
        /// </summary>
        private void EstablishConnnection()
        {
            // Open connection.
            SqlConnectionStringBuilder localConnectionString =
                new SqlConnectionStringBuilder(_credentials.ConnectionInfoShard.ConnectionString)
            {
                DataSource     = this.Location.DataSource,
                InitialCatalog = this.Location.Database
            };

            SqlConnectionInfo localConnectionInfo =
                _credentials.ConnectionInfoShard.CloneWithUpdatedConnectionString(
                    localConnectionString.ConnectionString);

            _localConnection = new SqlStoreConnection(
                StoreConnectionKind.LocalSource,
                localConnectionInfo);

            _localConnection.Open();
        }
        /// <summary>
        /// Terminates connection on the source shard object.
        /// </summary>
        private void KillConnectionsOnSourceShard()
        {
            SqlUtils.WithSqlExceptionHandling(() =>
            {
                string sourceShardConnectionString        = this.GetConnectionStringForShardLocation(_mappingSource.StoreShard.Location);
                SqlCredential sourceShardSecureCredential = this.GetSecureCredentialForShardLocation(_mappingSource.StoreShard.Location);

                IStoreResults result;

                using (IStoreConnection connectionForKill = this.Manager.StoreConnectionFactory.GetConnection(
                           StoreConnectionKind.LocalSource,
                           sourceShardConnectionString,
                           sourceShardSecureCredential))
                {
                    connectionForKill.Open();

                    using (IStoreTransactionScope ts = connectionForKill.GetTransactionScope(StoreTransactionScopeKind.NonTransactional))
                    {
                        result = ts.ExecuteOperation(
                            StoreOperationRequestBuilder.SpKillSessionsForShardMappingLocal,
                            StoreOperationRequestBuilder.KillSessionsForShardMappingLocal(_patternForKill));
                    }
                }

                if (result.Result != StoreResult.Success)
                {
                    // Possible errors are:
                    // StoreResult.UnableToKillSessions
                    // StoreResult.StoreVersionMismatch
                    // StoreResult.MissingParametersForStoredProcedure
                    throw StoreOperationErrorHandler.OnShardMapErrorLocal(
                        result,
                        _shardMap,
                        _mappingSource.StoreShard.Location,
                        _errorCategory,
                        StoreOperationErrorHandler.OperationNameFromStoreOperationCode(this.OperationCode),
                        StoreOperationRequestBuilder.SpKillSessionsForShardMappingLocal);
                }
            });
        }
 /// <summary>
 /// Establishes connection to the SMM GSM database.
 /// </summary>
 private void EstablishConnnection()
 {
     _globalConnection = new SqlStoreConnection(StoreConnectionKind.Global, _credentials.ConnectionStringShardMapManager);
     _globalConnection.Open();
 }
        /// <summary>
        /// Establishes connection to the target shard.
        /// </summary>
        private void EstablishConnnection()
        {
            // Open connection.
            SqlConnectionStringBuilder localConnectionString =
                new SqlConnectionStringBuilder(_credentials.ConnectionStringShard)
                {
                    DataSource = this.Location.DataSource,
                    InitialCatalog = this.Location.Database
                };

            _localConnection = new SqlStoreConnection(StoreConnectionKind.LocalSource, localConnectionString.ConnectionString);
            _localConnection.Open();
        }