/// <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;
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StartupTaskBuilder"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public StartupTaskBuilder(StartupTaskOptions options)
 {
     _options = options;
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StartupTaskStarter"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public StartupTaskStarter(StartupTaskOptions options)
 {
     _options = options;
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StartupTaskBuilder"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public StartupTaskBuilder(StartupTaskOptions options)
 {
     _options = options;
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StartupTaskStarter"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public StartupTaskStarter(StartupTaskOptions options)
 {
     _options = options;
 }