Пример #1
0
        /// <summary>
        /// Use the KickStart extension to configure Ninject.
        /// </summary>
        /// <param name="configurationBuilder">The configuration builder.</param>
        /// <param name="configure">The <see langword="delegate"/> to configure Ninject options.</param>
        /// <returns>
        /// A fluent <see langword="interface"/> to configure KickStart.
        /// </returns>
        public static IConfigurationBuilder UseNinject(this IConfigurationBuilder configurationBuilder, Action <INinjectBuilder> configure)
        {
            var options = new NinjectOptions();
            var service = new NinjectStarter(options);

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

            configurationBuilder.ExcludeName("Ninject");
            configurationBuilder.Use(service);

            return(configurationBuilder);
        }
Пример #2
0
        /// <summary>
        /// Use the KickStart extension to configure Ninject.
        /// </summary>
        /// <param name="configurationBuilder">The configuration builder.</param>
        /// <param name="configure">The <see langword="delegate"/> to configure Ninject options.</param>
        /// <returns>
        /// A fluent <see langword="interface"/> to configure KickStart.
        /// </returns>
        public static IConfigurationBuilder UseNinject(this IConfigurationBuilder configurationBuilder, Action <INinjectBuilder> configure)
        {
            var options = new NinjectOptions();
            var service = new NinjectStarter(options);

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

            configurationBuilder.ExcludeAssemblyFor <NinjectStarter>();
            configurationBuilder.ExcludeAssemblyFor <global::Ninject.IKernel>();
            configurationBuilder.Use(service);

            return(configurationBuilder);
        }