/// <summary> /// Use the startup task extension to execute all instances of <see cref="IStartupTask" />. /// </summary> /// <param name="configurationBuilder">The configuration builder.</param> /// <param name="configure">The <see langword="delegate"/> to configure StartupTask options.</param> /// <returns> /// A fluent <see langword="interface" /> to configure startup tasks /// </returns> /// <example>Configure KickStart to use startup tasks using Autofac container to resolve <see cref="IStartupTask" /> instances. /// <code><![CDATA[ /// Kick.Start(config => config /// .IncludeAssemblyFor<TestStartup>() /// .UseAutofac() /// .UseStartupTask(c => c.UseContainer()) /// .LogLevel(TraceLevel.Verbose) /// );]]></code> /// </example> public static IConfigurationBuilder UseStartupTask(this IConfigurationBuilder configurationBuilder, Action<IStartupTaskBuilder> configure) { var options = new StartupTaskOptions(); var starter = new StartupTaskStarter(options); if (configure != null) { var builder = new StartupTaskBuilder(options); configure(builder); } configurationBuilder.Use(starter); return configurationBuilder; }
/// <summary> /// Initializes a new instance of the <see cref="StartupTaskBuilder"/> class. /// </summary> /// <param name="options">The options.</param> public StartupTaskBuilder(StartupTaskOptions options) { _options = options; }
/// <summary> /// Initializes a new instance of the <see cref="StartupTaskStarter"/> class. /// </summary> /// <param name="options">The options.</param> public StartupTaskStarter(StartupTaskOptions options) { _options = options; }