/// <summary> /// Scans for types that satisfy specified predicates located in the specified scan path. /// </summary> /// <param name="context">The context.</param> /// <param name="assemblyScanPath">The assembly scan path.</param> /// <param name="assemblyPredicate">The assembly predicate.</param> /// <param name="typePredicate">The type predicate.</param> public static void Scan(this AbstractApplicationContext context, string assemblyScanPath, Predicate<Assembly> assemblyPredicate, Predicate<Type> typePredicate) { //create a scanner instance using the scan path var scanner = new AssemblyObjectDefinitionScanner(assemblyScanPath); //configure the scanner per the provided constraints scanner.WithAssemblyFilter(assemblyPredicate).WithIncludeFilter(typePredicate); //pass the scanner to primary Scan method to actually do the work Scan(context, scanner); }
private void ParseBaseAssembliesAttribute(AssemblyObjectDefinitionScanner scanner, XmlElement element) { var baseAssemblies = element.GetAttribute(BASE_ASSEMBLIES_ATTRIBUTE); if (string.IsNullOrEmpty(baseAssemblies)) return; foreach (var baseAssembly in baseAssemblies.Split(',')) { scanner.WithAssemblyFilter(assy => assy.FullName.StartsWith(baseAssembly)); } }