internal void DetectSharedConnectionConflict(WorkflowCommitWorkBatchService transactionService)
        {
            SharedConnectionWorkflowCommitWorkBatchService service = transactionService as SharedConnectionWorkflowCommitWorkBatchService;

            if ((service != null) && (string.Compare(service.ConnectionString, this.connString, StringComparison.Ordinal) != 0))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.SharedConnectionStringSpecificationConflict, new object[] { this.connString, service.ConnectionString }));
            }
        }
        private static SharedConnectionInfo GetConnectionInfo(WorkflowCommitWorkBatchService txSvc, Transaction transaction)
        {
            SharedConnectionInfo connectionInfo = null;
            SharedConnectionWorkflowCommitWorkBatchService service = txSvc as SharedConnectionWorkflowCommitWorkBatchService;

            if (service != null)
            {
                connectionInfo = service.GetConnectionInfo(transaction);
                if (connectionInfo == null)
                {
                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.InvalidTransaction, new object[0]));
                }
            }
            return(connectionInfo);
        }
        /*
         * private void SetLocalProvider(string connectionString)
         * {
         *  // Assume caller already validated the connection string
         *  MatchCollection providers = Regex.Matches(connectionString, @"(^|;)\s*provider\s*=[^;$]*(;|$)", RegexOptions.IgnoreCase);
         *
         *  // Cannot use DbConnectionStringBuilder because it selects the last provider, not the first one, by itself.
         *  // A legal Sql connection string allows for multiple provider specification and
         *  // selects the first provider
         *  if (providers.Count > 0)
         *  {
         *      // Check if the first one matches "sqloledb" or "sqloledb.<digit>"
         *      if (Regex.IsMatch(providers[0].Value, @"provider\s*=\s*sqloledb(\.\d+)?\s*(;|$)", RegexOptions.IgnoreCase))
         *      {
         *          this.localProvider = Provider.OleDB;
         *      }
         *      else
         *      {
         *          // We don't support other providers
         *          throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,ExecutionStringManager.UnsupportedSqlProvider, providers[0].Value));
         *      }
         *  }
         *  else
         *  {
         *      // SqlClient provider requires no provider keyword specified in connection string
         *      this.localProvider = Provider.SqlClient;
         *  }
         * }
         */

        private static SharedConnectionInfo GetConnectionInfo(WorkflowCommitWorkBatchService txSvc, Transaction transaction)
        {
            SharedConnectionInfo connectionInfo = null;

            SharedConnectionWorkflowCommitWorkBatchService scTxSvc = txSvc as SharedConnectionWorkflowCommitWorkBatchService;

            if (scTxSvc != null)
            {
                connectionInfo = scTxSvc.GetConnectionInfo(transaction);

                // The transaction service can't find entry if the transaction has been completed.
                // be sure to propate the error so durable services can cast to appropriate exception
                if (connectionInfo == null)
                {
                    throw new ArgumentException(
                              String.Format(CultureInfo.CurrentCulture, ExecutionStringManager.InvalidTransaction));
                }
            }
            return(connectionInfo);
        }