Пример #1
0
        private static IEnumerable <Assembly> GetCandidateAssemblies(IHostingEnvironment environment)
        {
            //todo  这里有问题 需要获取到  mvc程序集
            var parts = DefaultApplicationPartFactory.GetDefaultApplicationParts(Assembly.Load(new AssemblyName(environment.ApplicationName)));

            //var parts = DefaultAssemblyPartDiscoveryProvider.DiscoverAssemblyParts(environment.ApplicationName);
            return(parts
                   .OfType <AssemblyPart>()
                   .Select(p => p.Assembly)
                   .ToArray());
        }
 /// <inheritdoc />
 public override IEnumerable <ApplicationPart> GetApplicationParts(Assembly assembly)
 {
     return(Enumerable.Concat(
                DefaultApplicationPartFactory.GetDefaultApplicationParts(assembly),
                CompiledRazorAssemblyApplicationPartFactory.GetDefaultApplicationParts(assembly)));
 }