コード例 #1
0
        private void LoadApplicationAssemblies()
        {
            var exeRoot     = Path.GetDirectoryName(typeof(SiloAssemblyLoader).GetTypeInfo().Assembly.Location);
            var appRoot     = Path.Combine(exeRoot, "Applications");
            var cwd         = Directory.GetCurrentDirectory();
            var directories = new Dictionary <string, SearchOption>
            {
                { exeRoot, SearchOption.TopDirectoryOnly },
                { appRoot, SearchOption.AllDirectories }
            };

            if (!directories.ContainsKey(cwd))
            {
                directories.Add(cwd, SearchOption.TopDirectoryOnly);
            }

            AssemblyLoaderPathNameCriterion[] excludeCriteria =
            {
                AssemblyLoaderCriteria.ExcludeResourceAssemblies,
                AssemblyLoaderCriteria.ExcludeSystemBinaries()
            };
            AssemblyLoaderReflectionCriterion[] loadCriteria =
            {
                AssemblyLoaderReflectionCriterion.NewCriterion(
                    TypeUtils.IsConcreteGrainClass,
                    "Assembly does not contain any acceptable grain types."),
                AssemblyLoaderCriteria.LoadTypesAssignableFrom(
                    typeof(IProvider))
            };

            discoveredAssemblyLocations = AssemblyLoader.LoadAssemblies(directories, excludeCriteria, loadCriteria, logger);
        }
コード例 #2
0
        private void LoadApplicationAssemblies()
        {
            var exeRoot     = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var appRoot     = Path.Combine(exeRoot, "Applications");
            var directories = new Dictionary <string, SearchOption>
            {
                { exeRoot, SearchOption.TopDirectoryOnly },
                { appRoot, SearchOption.AllDirectories }
            };

            AssemblyLoaderPathNameCriterion[] excludeCriteria =
            {
                AssemblyLoaderCriteria.ExcludeResourceAssemblies,
                AssemblyLoaderCriteria.ExcludeSystemBinaries()
            };
            AssemblyLoaderReflectionCriterion[] loadCriteria =
            {
                AssemblyLoaderReflectionCriterion.NewCriterion(
                    TypeUtils.IsConcreteGrainClass,
                    "Assembly does not contain any acceptable grain types."),
                AssemblyLoaderCriteria.LoadTypesAssignableFrom(
                    typeof(IProvider))
            };

            AssemblyLoader.LoadAssemblies(directories, excludeCriteria, loadCriteria, logger);
        }
コード例 #3
0
        private void LoadApplicationAssemblies()
        {
            AssemblyLoaderPathNameCriterion[] excludeCriteria =
            {
                AssemblyLoaderCriteria.ExcludeResourceAssemblies,
                AssemblyLoaderCriteria.ExcludeSystemBinaries()
            };
            AssemblyLoaderReflectionCriterion[] loadCriteria =
            {
                AssemblyLoaderReflectionCriterion.NewCriterion(
                    TypeUtils.IsConcreteGrainClass,
                    "Assembly does not contain any acceptable grain types."),
                AssemblyLoaderCriteria.LoadTypesAssignableFrom(
                    typeof(IProvider))
            };

            discoveredAssemblyLocations = AssemblyLoader.LoadAssemblies(directories, excludeCriteria, loadCriteria, logger);
        }