コード例 #1
0
        /// <summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app">app</param>
        /// <param name="env">env</param>
        public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserSettingContext context)
        {
            // add NLog to ASP.NET Core
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers().RequireAuthorization();
            });

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "UserSettings API v1");
            });
        }
コード例 #2
0
        public override void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserSettingContext context)
        {
            base.Configure(app, env, context);

            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();
        }
コード例 #3
0
 public UserSettingRepository(UserSettingContext context)
 {
     _context = context;
 }