void TryAdd(Type declaredType, out DurableType type) { if (DurableType.TryFrom(declaredType, out type)) { Add(type); } }
public static bool TryFrom(string prefix, Type declaredType, out DurableType type) { type = DurablePrefix.TryFrom(prefix, out var parsedPrefix) ? CreateType(parsedPrefix, declaredType) : null; return(type != null); }
public static bool TryFrom(DurablePrefix prefix, Type declaredType, out DurableType type) { type = IsDurable(declaredType) ? CreateType(prefix, declaredType) : null; return(type != null); }
public static bool TryFrom(Type declaredType, out DurableType type) { type = IsDurable(declaredType) && TryGetKey(declaredType, out var key) ? new DurableType(key, declaredType) : null; return(type != null); }
public bool TryGetOrAdd(Type declaredType, out DurableType type) { lock (_byKey) { if (!_byDeclaredType.TryGetValue(declaredType, out type)) { TryAdd(declaredType, out type); } } return(type != null); }
void Add(DurableType type) { _byKey[type.Key] = type; _byDeclaredType[type.DeclaredType] = type; }