public void ConfigureServices(IServiceCollection services) { services.AddRapierControllers(opt => { opt.ContextTypes = new[] { typeof(RapierDbContext), typeof(IAssemblyMarker) }; opt.Add(typeof(Blog), "api/blogs") .ExpandMembersExplicitly(nameof(BlogResponse.Posts)) .Authorize(AuthorizationCategory.None, AuthorizationPolicies.WorksForRapier) .AuthorizeAction(DefaultAction.Delete, AuthorizationCategory.Custom); opt.Add(typeof(Post), "api/posts"); opt.Add(typeof(Author), "api/authors"); opt.SwaggerConfiguration = SwaggerConfig.GetSwaggerConfiguration(); }); //services.Configure<ApiBehaviorOptions>(opt => //{ // opt.InvalidModelStateResponseFactory = actionContext => // { // return new BadRequestResult(); // }; //}); services.AddDbContext <RapierDbContext>(options => options.UseSqlServer(Configuration .GetConnectionString("sqlConn")) .LogTo(Console.WriteLine) .EnableSensitiveDataLogging()); services.AddCors(ConfigNames.CorsPolicy); services.AddJwt(Configuration); services.AddAuthorizationHandlers(); // services.AddSwagger(); services.AddSwaggerDocument(); services.AddRapier(); }