public static string GetProcedureText(string procedureName, SqlConnection conn = null)
        {
            bool externalConnection = conn != null;

            try
            {
                if (conn == null)
                {
                    conn = DataLibrary.GetConnection();
                }
                using (UnitySqlCommand cmd = new UnitySqlCommand(conn, GetProcedureTextSql))
                {
                    cmd.Prepare();
                    cmd.Parameters["@ProcName"] = procedureName;
                    return(cmd.ExecuteScalar <string>(String.Empty));
                }
            }
            finally
            {
                if (externalConnection && conn != null)
                {
                    conn.Dispose();
                }
            }
        }
 public BaseCommand(SqlConnection connection, string procedureName)
 {
     this.procedureName = procedureName;
     if (connection == null)
     {
         connection = DataLibrary.GetConnection();
     }
     else
     {
         externalConnection = true;
     }
     this.sqlConnection = connection;
 }