Ejemplo n.º 1
0
 /// <summary>
 ///     Deserialize the JSON GZIP compressed string into a model
 /// </summary>
 /// <param name="jsonModel">JSON string to be serialized</param>
 /// <typeparam name="T">Type of ModelBase</typeparam>
 /// <returns>Model</returns>
 public static T DeserializeCompressed <T>(string jsonModel)
 {
     return(JsonConvert.DeserializeObject <T>(Gzip.DecompressJson(jsonModel), JsonSerializerSettings));
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Serializes the model into JSON string compressed using GZIP
 /// </summary>
 /// <param name="model">Model to be serialized</param>
 /// <typeparam name="T">Type of ModelBase</typeparam>
 /// <returns>JSON string</returns>
 public static string SerializeWithCompression <T>(T model)
 {
     return(Gzip.CompressJson(JsonConvert.SerializeObject(model, JsonSerializerSettings)));
 }