Internal class for managing injection metadata. Not intended for direct use in applications.
        private InjectionMetadata FindAutowiringMetadata(Type objectType)
        {
            // Quick check on the concurrent map first, with minimal locking.
            InjectionMetadata metadata = null;

            if (_injectionMetadataCache.ContainsKey(objectType))
            {
                metadata = _injectionMetadataCache[objectType];
            }

            if (metadata == null)
            {
                lock (_injectionMetadataCache)
                {
                    if (!_injectionMetadataCache.ContainsKey(objectType))
                    {
                        metadata = BuildAutowiringMetadata(objectType);
                        _injectionMetadataCache.Add(objectType, metadata);
                    }
                }
            }
            return(metadata);
        }
Пример #2
0
 public static bool NeedsRefresh(InjectionMetadata metadata, Type type)
 {
     return(metadata == null || metadata.targetType != type);
 }