/**
         * Begin asynchronous execution of a query.
         * @param query The query to execute. Can be one of the following:
         * <ul>
         * <li><b>randomize</b> Randomizes a pseudonym. parameters[0] must be the pseudonym to randomize.
         * <li><b>getEP</b> Returns an encrypted pseudonym. parameters[0] must be the User ID, parameters[0] the SP ID.
         * <li><b>getEP</b> Returns a polymorphic pseudonym. parameters[0] must be the User ID.
         * </ul>
         * @param parameters The parameters for the query.
         * @param callback The delegate to call when execution is finished.
         * @param state Not used.
         * @return IAsyncResult for the asynchronous execution.
         */
        public IAsyncResult BeginExecuteQuery(string query, string[] parameters, AsyncCallback callback, object state)
        {
            PolyPseudWorker worker = new PolyPseudWorker(parameters, config["y_k"], config["connectionString"], config["pseudonymProviderUrl"]);

            switch(query)
            {
                case "randomize":
                    func = new Func<string[][]>(worker.Randomize);
                    return func.BeginInvoke(callback, state);
                case "getEP":
                    func = new Func<string[][]>(worker.GetEP);
                    return func.BeginInvoke(callback, state);
                case "getPP":
                    func = new Func<string[][]>(worker.GetPP);
                    return func.BeginInvoke(callback, state);
                default:
                    throw new ArgumentException(String.Format("The query '{0}' is not recognized.", query));
            }
        }
        /**
         * Begin asynchronous execution of a query.
         * @param query The query to execute. Can be one of the following:
         * <ul>
         * <li><b>randomize</b> Randomizes a pseudonym. parameters[0] must be the pseudonym to randomize.
         * <li><b>getEP</b> Returns an encrypted pseudonym. parameters[0] must be the User ID, parameters[0] the SP ID.
         * <li><b>getEP</b> Returns a polymorphic pseudonym. parameters[0] must be the User ID.
         * </ul>
         * @param parameters The parameters for the query.
         * @param callback The delegate to call when execution is finished.
         * @param state Not used.
         * @return IAsyncResult for the asynchronous execution.
         */
        public IAsyncResult BeginExecuteQuery(string query, string[] parameters, AsyncCallback callback, object state)
        {
            PolyPseudWorker worker = new PolyPseudWorker(parameters, config["y_k"], config["connectionString"], config["pseudonymProviderUrl"]);

            switch (query)
            {
            case "randomize":
                func = new Func <string[][]>(worker.Randomize);
                return(func.BeginInvoke(callback, state));

            case "getEP":
                func = new Func <string[][]>(worker.GetEP);
                return(func.BeginInvoke(callback, state));

            case "getPP":
                func = new Func <string[][]>(worker.GetPP);
                return(func.BeginInvoke(callback, state));

            default:
                throw new ArgumentException(String.Format("The query '{0}' is not recognized.", query));
            }
        }