Exemple #1
0
 void TryAdd(Type declaredType, out DurableType type)
 {
     if (DurableType.TryFrom(declaredType, out type))
     {
         Add(type);
     }
 }
Exemple #2
0
        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);
        }
Exemple #3
0
        public static bool TryFrom(DurablePrefix prefix, Type declaredType, out DurableType type)
        {
            type = IsDurable(declaredType)
        ? CreateType(prefix, declaredType)
        : null;

            return(type != null);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        public bool TryGetOrAdd(Type declaredType, out DurableType type)
        {
            lock (_byKey)
            {
                if (!_byDeclaredType.TryGetValue(declaredType, out type))
                {
                    TryAdd(declaredType, out type);
                }
            }

            return(type != null);
        }
Exemple #6
0
 void Add(DurableType type)
 {
     _byKey[type.Key] = type;
     _byDeclaredType[type.DeclaredType] = type;
 }