/// <summary> /// Resets the builder type cache, in case you really need that to happen /// </summary> public static void InvalidateBuilderTypeCache() { lock (BuilderTypeCache) { BuilderTypeCache.Clear(); } }
/// <summary> /// Searches for an existing builder for the given type, first considering /// the same assembly as the provided type and then considering all assemblies /// within the AppDomain of the provided type. /// </summary> /// <param name="type">Type to search for a builder for</param> /// <returns>GenericBuilder type or null if no suitable builder was found</returns> public static Type TryFindExistingBuilderFor(Type type) { if (type == null) { return(null); } lock (BuilderTypeCache) { if (BuilderTypeCache.TryGetValue(type, out var result)) { return(result); } } return(TryFindExistingBuilderAndCacheFor(type)); }