Esempio n. 1
0
        // begin-snippet: include-only-extension
        public static AssemblyScannerConfiguration IncludeOnly(this AssemblyScannerConfiguration configuration, params string[] assembliesToInclude)
        {
            var excluded = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll")
                           .Select(path => Path.GetFileName(path))
                           .Where(existingAssembly => !assembliesToInclude.Contains(existingAssembly))
                           .ToArray();

            configuration.ExcludeAssemblies(excluded);

            return(configuration);
        }
Esempio n. 2
0
        public static AssemblyScannerConfiguration IncludeOnlyThisAssemblyAndReferences(this AssemblyScannerConfiguration configuration)
        {
            var callingAssembly           = Assembly.GetCallingAssembly();
            var referencedAssembliesNames = callingAssembly.GetReferencedAssemblies().Select(an => an.Name).ToList();

            referencedAssembliesNames.Add(callingAssembly.GetName().Name);

            return(IncludeOnly(configuration, referencedAssembliesNames.ToArray()));
        }