Exemplo n.º 1
0
        public PluginPoweredProcessHost(
            [IOC(false)] IPluginDescriptor descriptor,
            [IOC(true)] IPluginAssemblyFactory assemblyFactory,
            [IOC(true)] IJobFactory jobFactory)
            : base(jobFactory)
        {
            if (descriptor == null) throw Ex.ArgNull(() => descriptor);
            if (assemblyFactory == null) throw Ex.ArgNull(() => assemblyFactory);
            if (jobFactory == null) throw Ex.ArgNull(() => jobFactory);

            try
            {
                if (!descriptor.IsUsable)
                {
                    throw Ex.Arg(() => descriptor, "Descriptor must be for a usable plugin");
                }

                if (!descriptor.Metadata.InterfaceType.Equals(typeof(IProcess)))
                {
                    throw Ex.Arg(() => descriptor, "Descriptor must be for a process plugin");
                }

                _pluginDescriptor = descriptor;
                _pluginAssemblyFactory = assemblyFactory;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Failed to create plugin powered process host", ex);
            }
        }
Exemplo n.º 2
0
 public PluginAssembly(string path, IPluginAssemblyFactory assemblyFactory)
 {
     _path = path;
     _pluginAssemblyFactory = assemblyFactory;
 }