public void UpdateContent() { if (typeof(T) == typeof(NCDCDataCollection)) { var objects = ResponseObject as NCDCDataCollection; foreach (var obj in objects) { var station = NCDCStation.GetStationInformation(Command.DataSetName, obj.Station.id, Command.Token, null); obj.Station = station.ResponseObject; var dataType = NCDCDataType.GetDataTypeInformationForDataset(Command.DataSetName, obj.DataType.id, Command.Token, null); obj.DataType = dataType.ResponseObject; } } }
/// <summary> /// Reads the JSON representation of the object. /// </summary> /// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader"/> to read from.</param> /// <param name="objectType">Type of the object.</param> /// <param name="existingValue">The existing value of object being read.</param> /// <param name="serializer">The calling serializer.</param> /// <returns>The object value.</returns> /// <remarks></remarks> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { NCDCDataType result = existingValue as NCDCDataType; if (result == null) result = new NCDCDataType(); int startDepth = reader.Depth; while (reader.Read() && reader.Depth >= startDepth) { if (reader.TokenType == JsonToken.String) { result.id = reader.Value.ToString(); } } return result; }