protected IDictionary <string, object> GetInputs()
        {
            IDictionary <string, object> parameters = null;

            try
            {
                parameters = SerialiserHelpers.DeserialiseSimpleJson(Job.SerialisedInputParams)
                             .ToDictionary(pair => pair.Key, pair => (object)pair.Value);
            }
            catch
            {
                log.Log("Parameters are not in JSON format, or are poorly formatted JSON.");

                try
                {
                    parameters = SerialiserHelpers.DeserializeXml <IDictionary <string, object> >(Job.SerialisedInputParams);
                }
                catch
                {
                    log.Log("Parameters are not in XML format, or are poorly formatted XML.");
                }

                if (parameters == null)
                {
                    throw new InvalidPluginExecutionException("Failed to parse input params.");
                }
            }

            return(parameters);
        }
示例#2
0
        public QueryExpression GetCachedQuery(QueryBase query)
        {
            var serialisedQuery = SerialiserHelpers.SerialiseXml(query);

            queryCache.TryGetValue(serialisedQuery, out var queryExpression);
            return(queryExpression == null ? null : SerialiserHelpers.DeserializeXml <QueryExpression>(queryExpression));
        }