public virtual void RemoveStorableType(Type typeToRemove) { if (StoredTypes.Contains(typeToRemove)) { StoredTypes.Remove(typeToRemove); } }
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); } }
public virtual void AddStorableType(Type typeToAdd) { if (IsTypeStorable(typeToAdd, false)) { return; } if (StoredTypes.Contains(typeToAdd)) { return; } StoredTypes.Add(typeToAdd); }
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}"); } }
public virtual PropertyValueType LookUpType(String typeName) { PropertyValueType type = null; foreach (PropertyValueType t in StoredTypes) { if (t.ValueTypeName == typeName) { type = t; break; } } if (null == type) { type = new PropertyValueType(typeName); if (null != type) { StoredTypes.Add(type); } } return(type); }
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) !;
/// <inheritdoc /> protected override bool IsQualifiedByPredicate(Type type) { return(StoredTypes.Contains(type) == false); }