private static Dictionary<string, object> GetKeyValues(DynamicParameters dp)
 {
     var all = Enum.GetValues(typeof(BindingFlags))
                   .Cast<BindingFlags>()
                   .Aggregate((BindingFlags)0, (flags, bindingFlags) => flags | bindingFlags);
     var fieldInfo = dp.GetType().GetField("parameters", all);
     if (fieldInfo == null)
     {
         throw new InvalidOperationException();
     }
     var paramInfos = fieldInfo.GetValue(dp);
     var dictionary = new Dictionary<string, object>();
     foreach (var name in dp.ParameterNames)
     {
         var paramInfo = (paramInfos as IDictionary);
         if (paramInfo == null)
         {
             throw new InvalidOperationException();
         }
         var value = paramInfo[name];
         dictionary.Add(name, value.GetType().GetProperty("Value").GetValue(value));
     }
     return dictionary;
 }