예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider  ConfigureServices(IServiceCollection services)
        {
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            var assembly = typeof(Startup).GetTypeInfo().Assembly;

            services.AddMvc()
            .AddApplicationPart(assembly)
            .AddControllersAsServices();

            AgilityContext.ConfigureServices(services, Configuration);

            // Build the intermediate service provider then return it
            return(services.BuildServiceProvider());
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            var assembly = typeof(Startup).GetTypeInfo().Assembly;

            services.AddMvc()
            .AddApplicationPart(assembly)
            .AddControllersAsServices();

            //joelv: i think this was throwing an error..
            //.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            AgilityContext.ConfigureServices(services, Configuration);
        }
예제 #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider  ConfigureServices(IServiceCollection services)
        {
            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddRazorPages().AddRazorRuntimeCompilation();

            // If using IIS:
            services.Configure <IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            AgilityContext.ConfigureServices(services, Configuration);

            // Build the intermediate service provider then return it
            return(services.BuildServiceProvider());
        }