public override object FromRawState(TextState raw)
 {
     try
     {
         var stateType = StoredTypes.ForName(raw.Type);
         return(JsonSerialization.Deserialized(raw.Data, stateType) !);
     }
     catch (Exception e)
     {
         throw new InvalidOperationException($"Cannot convert to type: {raw.Type}", e);
     }
 }
Example #2
0
 public override TState FromEntry(TextEntry entry)
 {
     try
     {
         var sourceType = StoredTypes.ForName(entry.TypeName);
         var bland      = JsonSerialization.Deserialized(entry.EntryData, sourceType);
         return((TState)bland !);
     }
     catch (Exception)
     {
         throw new InvalidOperationException($"Cannot convert to type: {entry.TypeName}");
     }
 }
Example #3
0
        public static IEnumerable <IEntry <T> > None => new IEntry <T> [0]; // Enumerable.Empty<IEntry<T>>(); throws an exception on deserialization with Netwtonsoft

        public static Type TypedFrom(string type) => StoredTypes.ForName(type) !;