public static Type GetTypeFromAssemblies(String typeName) { IDictionary <String, Type> nameToTypeDict = nameToTypeDictTL.Value; Type type = DictionaryExtension.ValueOrDefault(nameToTypeDict, typeName); if (type != null) { return(type); } if (nameToTypeDict.ContainsKey(typeName)) { return(null); } type = Type.GetType(typeName); if (type != null) { nameToTypeDict.Add(typeName, type); return(type); } lock (Assemblies) { foreach (Assembly assembly in Assemblies) { type = assembly.GetType(typeName, false); if (type != null) { nameToTypeDict.Add(typeName, type); return(type); } } } // GN: If we add to the nameToTypeDict here, we have the problem, that we return in line 141 the next time, even if the type is available by that time. // Concrete example: ValueObjectConfigReader handles the configuration of "ProcessingRequest" from the delivery domain. This entity has a relation to // "ProcessingStepType" from the processing domain, hence the ValueObjectConfigReader calls this method to determine the VO type. As we are in a warehouse // screen that needs no procesing entities, the type cannot be found. Now we switch to another warehouse screen that has dependencies to processing, but we // return in line 141, although the assembly is now available. //nameToTypeDict.Add(typeName, null); return(null); }
public bool ContainsKey(K key) { int hashKey = key.GetHashCode(); List <Pair> list = DictionaryExtension.ValueOrDefault(dic, hashKey); if (list == null) { return(false); } for (int a = list.Count; a-- > 0;) { Pair p = list[a]; Object target = p.Key.Target; if (target == null) { continue; } if (AreKeysEqual((K)target, key)) { return(true); } } return(false); }
public WeakReference GetWeakReferenceEntry(K key) { int hashKey = key.GetHashCode(); List <Pair> list = DictionaryExtension.ValueOrDefault(dic, hashKey); if (list == null) { return(null); } for (int a = list.Count; a-- > 0;) { Pair p = list[a]; Object target = p.Key.Target; if (target == null) { continue; } if (AreKeysEqual((K)target, key)) { return(p.Key); } } return(null); }
public bool Contains(KeyValuePair <K, V> item) { V value = DictionaryExtension.ValueOrDefault(this, item.Key); return(Object.Equals(value, item.Value)); }
public static Type GetTypeFromCurrentDomain(String typeName) { return(DictionaryExtension.ValueOrDefault(nameToTypeDict, typeName)); }