Ejemplo n.º 1
0
        private IFileProvider GetModulesFileProvider(string[] basePaths, List<Assembly> moduleAssemblies)
        {
            // TODO - probably want to set this to be debug only as it allows serving content outside the root directory
            var redirectedFileProviders = basePaths
                .Select(path => Path.IsPathRooted(path) ? path : Path.Combine(ApplicationBasePath, path))
                .Select(root => new PhysicalFileProvider(root));

            var resourceFileProviders = moduleAssemblies.Select(a => new SafeEmbeddedFileProvider(a));

            IFileProvider rootProvider = new PhysicalFileProvider(ApplicationBasePath);
            return new CompositeFileProvider(
                    rootProvider
                        .Concat(redirectedFileProviders)
                        .Concat(resourceFileProviders)
                        );
        }