public PrependDsl <TPrepend> Prepend <TPrepend>( Func <TContext, bool> predicate = null, bool singleton = false) where TPrepend : TPlugin { return(Prepend <TPrepend>(PluginDefinition <TPlugin, TContext> .Create <TPrepend>(predicate, singleton))); }
public PrependDsl <TPrepend> Prepend <TPrepend>( TPrepend instance, Func <TContext, bool> predicate = null) where TPrepend : TPlugin { return(Prepend <TPrepend>(PluginDefinition <TPlugin, TContext> .Create(instance, predicate))); }
public PluginDefinitions <TPlugin, TContext> With <TReplacement>( TReplacement instance, Func <TContext, bool> predicate = null) where TReplacement : TPlugin { return(With <TReplacement>(PluginDefinition <TPlugin, TContext> .Create(instance, predicate))); }
public PluginDefinitions <TPlugin, TContext> With <TReplacement>( Func <TContext, bool> predicate = null, bool singleton = false) where TReplacement : TPlugin { return(With <TReplacement>(PluginDefinition <TPlugin, TContext> .Create <TReplacement>(predicate, singleton))); }
public static PluginDefinition <T> Create <TConcrete>(bool singleton = false) where TConcrete : T { var plugin = new PluginDefinition <T>(); plugin.Set <TConcrete>(singleton); return(plugin); }
public static PluginDefinition <T> Create <TConcrete>(TConcrete instance) where TConcrete : T { var plugin = new PluginDefinition <T>(); plugin.Set(instance); return(plugin); }
public PrependDsl <TPrepend> Prepend <TPrepend>( PluginDefinition <TPlugin, TContext> plugin) where TPrepend : TPlugin { Remove <TPrepend>(); _definitions.Insert(0, plugin); return(new PrependDsl <TPrepend>(_definitions, plugin)); }
public AppendDsl <TAppend> Append <TAppend>( PluginDefinition <TPlugin, TContext> plugin) where TAppend : TPlugin { Remove <TAppend>(); _definitions.Add(plugin); return(new AppendDsl <TAppend>(_definitions, plugin)); }
public PluginDefinitions <TPlugin, TContext> With <TReplacement>( PluginDefinition <TPlugin, TContext> plugin) where TReplacement : TPlugin { _plugins.Append <TReplacement>(plugin).After <TReplace>(); _plugins.Remove <TReplace>(); return(_plugins); }
public static void RegisterPlugin <TPlugin>(this IContainer container, PluginDefinition <TPlugin> pluginDefinition) where TPlugin : class { if (pluginDefinition.HasInstance) { container.Register(pluginDefinition.Instance); } else { container.Register <TPlugin>(pluginDefinition.Type, pluginDefinition.Singleton); } }
public int Order(PluginDefinition <TPlugin, TContext> definition) { var order = _definitions.IndexOf(definition); return(order >= 0 ? order : short.MaxValue); }
public PrependDsl( List <PluginDefinition <TPlugin, TContext> > definitions, PluginDefinition <TPlugin, TContext> plugin) : base(definitions) { _plugin = plugin; }