public PrependDsl Prepend <TPrepend>(
     Func <TContext, bool> predicate = null, bool @default = false)
     where TPrepend : TPlugin
 {
     return(Prepend(ConditionalPlugin <TPlugin, TContext>
                    .Create <TPrepend>(predicate ?? DefaultPredicate, Plugins.Singleton), @default));
 }
 public ConditionalPluginsDsl <TPlugin, TContext> WithOrAppend <TReplacement>(
     TReplacement instance, Func <TContext, bool> predicate = null,
     bool dispose = false, bool @default = false)
     where TReplacement : TPlugin
 {
     return(WithOrAppend(ConditionalPlugin <TPlugin, TContext>
                         .Create(instance, predicate ?? _defaultPredicate, dispose), @default));
 }
 public ConditionalPluginsDsl <TPlugin, TContext> WithOrAppend <TReplacement>(
     Func <TContext, bool> predicate = null, bool @default = false)
     where TReplacement : TPlugin
 {
     return(WithOrAppend(ConditionalPlugin <TPlugin, TContext>
                         .Create <TReplacement>(predicate ?? _defaultPredicate,
                                                _plugins.Singleton), @default));
 }
 public PrependDsl Prepend <TPrepend>(
     TPrepend instance, Func <TContext, bool> predicate = null,
     bool dispose = false, bool @default = false)
     where TPrepend : TPlugin
 {
     return(Prepend(ConditionalPlugin <TPlugin, TContext>
                    .Create(instance, predicate ?? DefaultPredicate, dispose), @default));
 }
 private ConditionalPluginsDsl <TPlugin, TContext> WithOrPrepend(
     ConditionalPlugin <TPlugin, TContext> plugin, bool @default = false)
 {
     _plugins.ReplaceAllOfTypeWithOrPrepend <TReplace>(plugin, @default);
     return(_dsl);
 }
 public PrependDsl(ConditionalPlugin <TPlugin, TContext> plugin,
                   ConditionalPlugins <TPlugin, TContext> plugins,
                   Func <TContext, bool> defaultPredicate) : base(plugins, defaultPredicate)
 {
     _plugin = plugin;
 }
 private PrependDsl Prepend(
     ConditionalPlugin <TPlugin, TContext> plugin, bool @default = false)
 {
     Plugins.Prepend(plugin, @default);
     return(new PrependDsl(plugin, Plugins, DefaultPredicate));
 }
Esempio n. 8
0
 public ConditionalPlugins(
     IEnumerable <ConditionalPlugin <TPlugin, TContext> > plugins,
     bool singleton, ConditionalPlugin <TPlugin, TContext> @default) :
     base(plugins, singleton, @default)
 {
 }
Esempio n. 9
0
 private ConditionalPlugin(ConditionalPlugin <TPlugin, TContext> source) : base(source)
 {
     AppliesTo = source.AppliesTo;
 }