Beispiel #1
0
        public DelegatePluginCatalog(MulticastDelegate multicastDelegate,
                                     List <DelegateConversionRule> conversionRules = null,
                                     PluginNameOptions nameOptions = null, DelegatePluginCatalogOptions options = null, string pluginName = null)
        {
            if (multicastDelegate == null)
            {
                throw new ArgumentNullException(nameof(multicastDelegate));
            }

            _multicastDelegate = multicastDelegate;

            if (conversionRules == null)
            {
                conversionRules = new List <DelegateConversionRule>();
            }

            if (options != null)
            {
                _options = options;
            }
            else
            {
                _options = new DelegatePluginCatalogOptions();
            }

            _options.ConversionRules = conversionRules;

            if (nameOptions == null)
            {
                nameOptions = new PluginNameOptions();
            }

            _options.NameOptions = nameOptions;

            if (!string.IsNullOrWhiteSpace(pluginName))
            {
                _options.NameOptions.PluginNameGenerator = (pluginNameOptions, type) => pluginName;
            }
        }
Beispiel #2
0
 public DelegatePluginCatalog(MulticastDelegate multicastDelegate, DelegatePluginCatalogOptions options) : this(multicastDelegate,
                                                                                                                options?.ConversionRules, options?.NameOptions, options)
 {
 }