/// <summary>
        /// Sets the replacement values.
        /// </summary>
        /// <param name="connectionName">Name of the connection.</param>
        /// <param name="values">The values.</param>
        public void SetReplacementValues(string connectionName, string[] values)
        {
            ConnectionManagerContext ctx = Context;

            ctx.CloseConnection(connectionName);
            ctx.Replacements[connectionName] = values;
        }
        /// <summary>
        /// Gets the connection.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public DbConnection GetConnection(string name)
        {
            // get context
            ConnectionManagerContext ctx = Context;

            // check if already open
            var cnxn = ctx.GetConnection(name);

            if ((cnxn != null) && (cnxn.State == ConnectionState.Open))
            {
                return(cnxn);
            }

            // prepare connection info
            cnxn = PerpareConnection(name);

            // open connection
            try
            {
                cnxn.Open();

                // enroll in transaction
                if (ctx.Transaction != null)
                {
                    DbTransactionRegistry.RegisterNewTransaction(cnxn);
                }

                SetConnection(name, cnxn);

                return(cnxn);
            }
            catch (Exception ex)
            {
                throw new DataException("Unable to connect to database", ex);
            }
        }