Esempio n. 1
0
        /// <summary>
        /// Use the KickStart extension to configure SimpleInjector.
        /// </summary>
        /// <param name="configurationBuilder">The configuration builder.</param>
        /// <param name="configure">The <see langword="delegate"/> to configure SimpleInjector options.</param>
        /// <returns>
        /// A fluent <see langword="interface"/> to configure KickStart.
        /// </returns>
        public static IConfigurationBuilder UseSimpleInjector(this IConfigurationBuilder configurationBuilder, Action <ISimpleInjectorBuilder> configure)
        {
            var options = new SimpleInjectorOptions();
            var starter = new SimpleInjectorStarter(options);

            if (configure != null)
            {
                var builder = new SimpleInjectorBuilder(options);
                configure(builder);
            }

            configurationBuilder.ExcludeName("SimpleInjector");
            configurationBuilder.Use(starter);

            return(configurationBuilder);
        }
        /// <summary>
        /// Use the KickStart extension to configure SimpleInjector.
        /// </summary>
        /// <param name="configurationBuilder">The configuration builder.</param>
        /// <param name="configure">The <see langword="delegate"/> to configure SimpleInjector options.</param>
        /// <returns>
        /// A fluent <see langword="interface"/> to configure KickStart.
        /// </returns>
        public static IConfigurationBuilder UseSimpleInjector(this IConfigurationBuilder configurationBuilder, Action <ISimpleInjectorBuilder> configure)
        {
            var options = new SimpleInjectorOptions();
            var starter = new SimpleInjectorStarter(options);

            if (configure != null)
            {
                var builder = new SimpleInjectorBuilder(options);
                configure(builder);
            }

            configurationBuilder.ExcludeAssemblyFor <SimpleInjectorStarter>();
            configurationBuilder.ExcludeAssemblyFor <global::SimpleInjector.Container>();
            configurationBuilder.Use(starter);

            return(configurationBuilder);
        }