Пример #1
0
        public virtual Task <Assembly> LoadAsync(IPluginLoadContext pluginLoadContext)
        {
            var loadContext = new DefaultAssemblyLoadContext <T>(
                this.logger,
                this.options,
                this.hostFrameworkProvider,
                this.hostTypesProvider,
                this.downgradableDependenciesProvider,
                this.remoteTypesProvider,
                this.dependencyPathProvider,
                this.probingPathsProvider,
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.pluginDependencyResolver,
                this.nativeAssemblyUnloader,
                this.assemblyLoadStrategyProvider
                );

            var loadedPluginKey = new LoadedPluginKey(pluginLoadContext);

            this.loadContexts[loadedPluginKey]          = loadContext;
            this.loadContextReferences[loadedPluginKey] = new System.WeakReference(loadContext);

            return(loadContext.LoadPluginAssemblyAsync(pluginLoadContext));
        }
Пример #2
0
        public virtual Assembly Load(IPluginLoadContext pluginLoadContext)
        {
            var pluginAssemblyName = Path.GetFileNameWithoutExtension(pluginLoadContext.PluginAssemblyName);
            var loadContext        = new DefaultAssemblyLoadContext <T>(
                this.logger,
                this.options,
                this.hostFrameworkProvider,
                this.hostTypesProvider,
                this.remoteTypesProvider,
                this.dependencyPathProvider,
                this.probingPathsProvider,
                this.runtimePlatformContext,
                this.depsFileProvider,
                this.pluginDependencyResolver,
                this.nativeAssemblyUnloader,
                this.assemblyLoadStrategyProvider
                );


            this.loadContexts[pluginAssemblyName]          = loadContext;
            this.loadContextReferences[pluginAssemblyName] = new System.WeakReference(loadContext);

            return(loadContext.LoadPluginAssembly(pluginLoadContext));
        }