Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DemoContext>(opt => opt.UseSqlite("Filename=demo.db"));

            // add schema provider so we don't need to create it everytime
            services.AddSingleton(GraphQLSchema.MakeSchema());
            services.AddMvc();
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DemoContext>(opt => opt.UseSqlite("Filename=demo.db"));

            services.AddSingleton <AgeService>();

            services.AddLogging(logging =>
            {
                logging.AddConsole(configure => Configuration.GetSection("Logging"));
                logging.AddDebug();
            });
            services.AddSingleton(new PageService());
            // add schema provider so we don't need to create it everytime
            services.AddSingleton(GraphQLSchema.MakeSchema());
            services.AddRouting();
            services.AddControllers().AddNewtonsoftJson();
        }