Example #1
0
        private static T ConvertType <T>(JsonBasedObject value)
        {
            if (value is T)
            {
                return((T)(object)value);
            }
            JsonBasedObject valueAsType = (JsonBasedObject)typeof(T).GetConstructor(new Type[] { typeof(IDictionary <string, object>) }).Invoke(new object[] { value.RawData });

            return((T)(object)valueAsType);
        }
Example #2
0
        protected T GetObjectAsType <T>(string key)
        {
            JsonBasedObject value = this.GetObject(key);

            if (value == null)
            {
                return((T)(object)null);
            }
            T typedValue = ConvertType <T>(value);

            this.SetObject(key, (JsonBasedObject)(object)typedValue);
            return(typedValue);
        }
Example #3
0
 public Task <Dictionary <string, object> > SendRequest(string serviceName, JsonBasedObject request)
 {
     return(SendRequest(serviceName, request.GetRawData()));
 }
Example #4
0
 protected void SetObject(string key, JsonBasedObject value)
 {
     this.SetValue(key, value);
 }