예제 #1
0
 public void AddAssembliesToScan(IEnumerable <Assembly> assemblies)
 {
     foreach (var assembly in assemblies)
     {
         AssembliesToScan.Add(assembly);
     }
 }
예제 #2
0
        public ICreateQuickMapsConfigurationOptions AddAssemblies(params Type[] assemblyTypeMarkers)
        {
            var assembliesToScan = assemblyTypeMarkers.Select(x => x.Assembly).ToArray();

            AssembliesToScan = AssembliesToScan.Concat(assembliesToScan).Distinct().ToArray();
            return(this);
        }
예제 #3
0
 /// <summary>
 /// Updates the assembly cache from the appdomain
 /// </summary>
 private static void UpdateAssemblies()
 {
     assemblies = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
                   where AssembliesToScan.Any(asm => asm(assembly))
                   where !assembly.IsDynamic
                   where !assembly.ReflectionOnly
                   select assembly).ToArray();
 }
예제 #4
0
 /// <summary>
 /// Updates the assembly cache from the appdomain
 /// </summary>
 private static void UpdateAssemblies()
 {
     _assemblies = AppDomain.CurrentDomain.GetAssemblies()
                   .Where(a => AssembliesToScan.Any(asm => asm(a)) && !a.IsDynamic && !a.ReflectionOnly)
                   .Select(a => a)
                   .ToArray();
     _assemblies = _assemblies.DistinctBy(x => x.GetName().Name);
 }
예제 #5
0
 public Configuration AddAssemblyToScan(params Assembly[] assemblies)
 {
     foreach (var assemblyToAdd in assemblies.Where(assemblyToAdd => AssembliesToScan.All(x => x.FullName != assemblyToAdd.FullName)))
     {
         AssembliesToScan.Add(assemblyToAdd);
     }
     return(this);
 }
예제 #6
0
        public IAddRemotiatrOptions AddAssemblies(params Assembly[] assembliesToScan)
        {
            if (assembliesToScan == null)
            {
                throw new ArgumentNullException(nameof(assembliesToScan));
            }

            AssembliesToScan = AssembliesToScan.Concat(assembliesToScan).Distinct().ToArray();
            return(this);
        }
예제 #7
0
        /// <summary>
        /// Add assemblies to the list of assemblies to scan for Nancy types
        /// </summary>
        /// <param name="assemblies">One of more assemblies</param>
        public static void AddAssembliesToScan(params Assembly[] assemblies)
        {
            foreach (var assembly in assemblies)
            {
                LoadAssemblies(assembly.GetName() + ".dll");
                LoadAssemblies(assembly.GetName() + ".exe");
            }

            var scanningPredicates = assemblies.Select(an => (Func <Assembly, bool>)(a => a == an));

            AssembliesToScan = AssembliesToScan.Union(scanningPredicates);
        }
예제 #8
0
        public IAddRemotiatrOptions AddAssemblies(params Type[] assemblyTypeMarkers)
        {
            if (assemblyTypeMarkers == null)
            {
                throw new ArgumentNullException(nameof(assemblyTypeMarkers));
            }

            var assembliesToScan = assemblyTypeMarkers.Select(x => x.Assembly).ToArray();

            AssembliesToScan = AssembliesToScan.Concat(assembliesToScan).Distinct().ToArray();
            return(this);
        }
        public static IEnumerable <IDependencyResolver> GetAllDependencyResolvers(TestHarnessTypeProvider typeProvider)
        {
            var dependencyResolvers = AssembliesToScan
                                      .SelectMany(a => a.GetExportedTypes())
                                      .Where(t => typeof(IDependencyResolverFactory).IsAssignableFrom(t))
                                      .Where(t => t.IsInstantiable())
                                      .Select(Activator.CreateInstance)
                                      .Cast <IDependencyResolverFactory>()
                                      .Select(factory => factory.Create(typeProvider))
                                      .ToArray();

            return(dependencyResolvers);
        }
예제 #10
0
        /// <summary>
        /// Add assemblies to the list of assemblies to scan for Nancy types
        /// </summary>
        /// <param name="assemblyNames">One or more assembly names</param>
        public static void AddAssembliesToScan(params string[] assemblyNames)
        {
            var normalisedNames = GetNormalisedAssemblyNames(assemblyNames).ToArray();

            foreach (var assemblyName in normalisedNames)
            {
                LoadAssemblies(assemblyName + ".dll");
                LoadAssemblies(assemblyName + ".exe");
            }

            var scanningPredicates = normalisedNames.Select(s =>
            {
                return((Func <Assembly, bool>)(a => a.GetName().Name == s));
            });

            AssembliesToScan = AssembliesToScan.Union(scanningPredicates);
        }
예제 #11
0
 /// <summary>
 /// Add predicates for determining which assemblies to scan for Nancy types
 /// </summary>
 /// <param name="predicates">One or more predicates</param>
 public static void AddAssembliesToScan(params Func <Assembly, bool>[] predicates)
 {
     AssembliesToScan = AssembliesToScan.Union(predicates);
 }
예제 #12
0
 public ICreateQuickMapsConfigurationOptions AddAssemblies(params Assembly[] assembliesToScan)
 {
     AssembliesToScan = AssembliesToScan.Concat(assembliesToScan).Distinct().ToArray();
     return(this);
 }