示例#1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddCors(Op => Op.AddPolicy("AllowAccess_To_API",
                                         policy => policy
                                         .AllowAnyOrigin()
                                         .AllowAnyHeader()
                                         .AllowAnyMethod()
                                         ));
     services.AddControllers();
     services.AddDbContext <UserDbContext>(op =>
                                           op.UseNpgsql(ConnectionString));
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new OpenApiInfo {
             Title = "User_Information", Version = "v1"
         });
     });
 }