예제 #1
0
 // Lastly, allow plugin modules to register services specific to their implementation.
 private void RegisterPluginServices(IServiceCollection services)
 {
     foreach (IPluginModule module in AllPlugins.SelectMany(p => p.Modules))
     {
         module.RegisterServices(services);
     }
 }
예제 #2
0
        /// <summary>
        /// Returns types associated with a specific category of plug-in.
        /// </summary>
        /// <param name="pluginTypes">The category of plug-ins to limit the return types.</param>
        /// <returns>List of limited plug in types or all plug-in types if no category is specified.</returns>
        public IEnumerable <Type> GetPluginTypes(params PluginTypes[] pluginTypes)
        {
            if (pluginTypes == null)
            {
                throw new ArgumentNullException(nameof(pluginTypes),
                                                "List of Plug-in types cannot be null.");
            }

            return(pluginTypes.Length == 0 ? AllPlugins.SelectMany(p => p.Types)
                : AllPlugins.Where(p => pluginTypes.Contains(p.PluginType)).SelectMany(p => p.Types));
        }
예제 #3
0
        private IEnumerable <Type> FilteredTypesByPluginType(IPlugin plugin)
        {
            // Core plug-in can access types from all other plug-in types.
            if (plugin.PluginType == PluginTypes.CorePlugin)
            {
                return(AllPlugins.SelectMany(p => p.Types));
            }

            // Application centric plug-in can only access types contained in
            // other application plugs.
            return(AppPlugins.SelectMany(p => p.Types));
        }