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); }
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); }
public Task <Dictionary <string, object> > SendRequest(string serviceName, JsonBasedObject request) { return(SendRequest(serviceName, request.GetRawData())); }
protected void SetObject(string key, JsonBasedObject value) { this.SetValue(key, value); }