private IEnumerable <Type> GetTypesAssignableToInternal(TypeInfo typeInfo, ScanningStrategy strategy)
        {
            foreach (var assembly in this.assemblies.Value)
            {
                if (assembly.IsDynamic)
                {
                    continue;
                }

                if (!strategy.Invoke(assembly))
                {
                    continue;
                }

                foreach (var exportedType in assembly.ExportedTypes)
                {
                    var exportedTypeInfo = exportedType.GetTypeInfo();

                    if (exportedTypeInfo.IsAbstract)
                    {
                        continue;
                    }

                    if (exportedTypeInfo.IsAssignableTo(typeInfo))
                    {
                        yield return(exportedType);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <Type> GetTypesAssignableTo(Type type, ScanningStrategy strategy)
        {
            Check.NotNull(type, nameof(type));
            Check.NotNull(strategy, nameof(strategy));

            var typeInfo = type.GetTypeInfo();

            foreach (var catalogType in this.types)
            {
                var catalogTypeInfo = catalogType.GetTypeInfo();

                if (!catalogTypeInfo.IsAssignableTo(typeInfo))
                {
                    continue;
                }

                if (strategy.Invoke(catalogTypeInfo.Assembly))
                {
                    yield return(catalogType);
                }
            }
        }