/// <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 GenericApplicationContext context, string assemblyScanPath, Predicate <Assembly> assemblyPredicate, Predicate <Type> typePredicate) { //create a scanner instance using the scan path var scanner = new AssemblyObjectDefinitionScanner(); //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); }
/// <summary> /// Scans the specified context. /// </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> /// <param name="assembliesToScan">The assemblies to scan.</param> public static void Scan(this GenericApplicationContext context, string assemblyScanPath, Func <Assembly, bool> assemblyPredicate, Func <Type, bool> typePredicate, params string[] assembliesToScan) { AssemblyObjectDefinitionScanner scanner = ArrayUtils.HasElements(assembliesToScan) ? new AssemblyObjectDefinitionScanner(assembliesToScan) : new AssemblyObjectDefinitionScanner(); scanner.ScanStartFolderPath = 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)); } }