Exemple #1
0
 public static void ScanAllMyAssemblies(this IAssemblyScanner scanner)
 {
     scanner.Assembly(typeof(Startup).GetTypeInfo().Assembly);
     scanner.Assembly("MediatrEF6PoC3.Models");
     scanner.Assembly("MediatrEF6PoC3.Messages");
     scanner.Assembly("MediatrEF6PoC3.EF6Handlers");
     scanner.Assembly("MediatrEF6PoC3.EF6");
 }
        public static void AssembliesFromPath(this IAssemblyScanner scanner, string path,
                                              Predicate <Assembly> assemblyFilter)
        {
            var assemblyPaths = Directory.GetFiles(path)
                                .Where(file =>
                                       Path.GetExtension(file).Equals(
                                           ".exe",
                                           StringComparison.OrdinalIgnoreCase)
                                       ||
                                       Path.GetExtension(file).Equals(
                                           ".dll",
                                           StringComparison.OrdinalIgnoreCase));

            foreach (var assemblyPath in assemblyPaths)
            {
                Assembly assembly = null;
                try
                {
                    assembly = Assembly.LoadFrom(assemblyPath);
                }
                catch
                {
                }
                if (assembly != null && assemblyFilter(assembly))
                {
                    scanner.Assembly(assembly);
                }
            }
        }
Exemple #3
0
        public static void TheCallingAssembly(this IAssemblyScanner scanner)
        {
            var callingAssembly = findTheCallingAssembly();

            if (callingAssembly != null)
            {
                scanner.Assembly(callingAssembly);
            }
        }
 private void ScanSolutionAssemblies(IAssemblyScanner scanner)
 {
     AppDomain
         .CurrentDomain
         .GetAssemblies()
         .Where(assembly => assembly.FullName.StartsWith("DotNetDns."))
         .ToList()
         .ForEach(assembly => scanner.Assembly(assembly));
 }
Exemple #5
0
        public static void AssembliesFromPath(this IAssemblyScanner scanner, string path)
        {
            var assemblies = AssemblyFinder.FindAssemblies(path, txt =>
            {
                Console.WriteLine("StructureMap could not load assembly from file " + txt);
            });

            foreach (var assembly in assemblies)
            {
                scanner.Assembly(assembly);
            }
        }
Exemple #6
0
        public static void AssembliesFromApplicationBaseDirectory(this IAssemblyScanner scanner, Func <Assembly, bool> assemblyFilter)
        {
            var assemblies = AssemblyFinder.FindAssemblies(assemblyFilter, txt =>
            {
                Console.WriteLine("StructureMap could not load assembly from file " + txt);
            });

            foreach (var assembly in assemblies)
            {
                scanner.Assembly(assembly);
            }
        }
        public static void AssembliesFromPath(this IAssemblyScanner scanner, string path,
                                              Func <Assembly, bool> assemblyFilter)
        {
            var assemblies = AssemblyFinder.FindAssemblies(path, txt =>
            {
                Console.WriteLine("StructureMap could not load assembly from file " + txt);
            }, includeExeFiles: false).Where(assemblyFilter);


            foreach (var assembly in assemblies)
            {
                scanner.Assembly(assembly);
            }
        }
        private void loadAssemblies(IAssemblyScanner obj)
        {
            obj.TheCallingAssembly();

            obj.AssemblyContainingType <IProductRepository>(); // Core

            obj.Assembly("Infrastructure");                    // the Infrastructure DLL

            obj.WithDefaultConventions();

            obj.With(new ControllerConvention());

            obj.LookForRegistries();
        }
Exemple #9
0
        private static void AddAssembliesToScan(IAssemblyScanner assemblyScanner)
        {
            var assemblies = AssemblyScanner.GetAssembliesInFolder(AppDomain.CurrentDomain.BaseDirectory, fileName => !fileName.StartsWith("libzmq-"))
                                            .Where(a => a != typeof(ZebusRegistry).Assembly);

            foreach (var assembly in assemblies)
            {
                assemblyScanner.Assembly(assembly);
            }
        }
 public static void AssemblyFromModule(this IAssemblyScanner scanner, string assemblyName)
 {
     scanner.Assembly(assemblyName + "." + ModuleStorage.Current);
 }
 private void AddAssemblies(IAssemblyScanner x)
 {
     x.Assembly(GetType().Assembly);
 }