コード例 #1
0
        /// <summary>
        /// If the service type was in a scanned assembly, throw the exception
        /// </summary>
        /// <param name="serviceType"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        public virtual bool IsScannedAssembly(Type serviceType, Exception exception)
        {
            if (_ScannedAssemblies.Count == 0)
            {
                // if not pre-filtered, we must filter them again :(
                if (_StartupConfiguration.AssemblyFilter is object)
                {
                    _ScannedAssemblies.AddRange(_StartupConfiguration.Assemblies.Where(a =>
                                                                                       _StartupConfiguration.AssemblyFilter.FilterAssembly(a) == false));
                }
                else
                {
                    _ScannedAssemblies.AddRange(_StartupConfiguration.Assemblies);
                }
            }

            var assembly = _ReflectionHelper.GetAssembly(serviceType);

            if (!_ScannedLookups.TryGetValue(assembly, out bool isScanned))
            {
                isScanned = _ScannedAssemblies.Any(x => x == assembly);
                _ScannedLookups[assembly] = isScanned;
            }

            if (exception is object && isScanned == false)
            {
                LogException(serviceType, exception);
            }

            return(isScanned);
        }