Пример #1
0
        public static IServiceProvider AddAbp(this IServiceCollection services, Action <AbpServiceOptions> optionsAction)
        {
            var options = new AbpServiceOptions
            {
                IocManager = IocManager.Instance
            };

            optionsAction(options);

            AddContextAccessors(services);

            var abpBootstrapper = AddAbpBootstrapper(services, options.IocManager);

            return(WindsorRegistrationHelper.CreateServiceProvider(abpBootstrapper.IocManager.IocContainer, services));
        }
        public static IServiceProvider AddAbp(this IServiceCollection services, Action<AbpServiceOptions> optionsAction)
        {
            var options = new AbpServiceOptions
            {
                IocManager = IocManager.Instance
            };

            optionsAction(options);

            ConfigureMvc(services, options.IocManager);

            var abpBootstrapper = AddAbpBootstrapper(services, options.IocManager);

            return WindsorRegistrationHelper.CreateServiceProvider(abpBootstrapper.IocManager.IocContainer, services);
        }
        /// <summary>
        /// Integrates ABP to AspNet Core.
        /// </summary>
        /// <typeparam name="TStartupModule">Startup module of the application which depends on other used modules. Should be derived from <see cref="AbpModule"/>.</typeparam>
        /// <param name="services">Services.</param>
        /// <param name="optionsAction">An action to get/modify options</param>
        public static IServiceProvider AddAbp <TStartupModule>(this IServiceCollection services, Action <AbpServiceOptions> optionsAction)
            where TStartupModule : AbpModule
        {
            var options = new AbpServiceOptions
            {
                IocManager = IocManager.Instance
            };

            optionsAction(options);

            ConfigureAspNetCore(services, options.IocManager);

            var abpBootstrapper = AddAbpBootstrapper <TStartupModule>(services, options.IocManager);

            abpBootstrapper.PlugInSources.AddRange(options.PlugInSources);

            return(WindsorRegistrationHelper.CreateServiceProvider(abpBootstrapper.IocManager.IocContainer, services));
        }