Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Program.cs 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using BlackRock.Reporting.API.Core;
  2. using BlackRock.Reporting.API.Models;
  3. using BlackRock.Reporting.API.Persistence;
  4. using BlackRock.Reporting.API.Profiles;
  5. using MediatR;
  6. using Microsoft.EntityFrameworkCore;
  7. var builder = WebApplication.CreateBuilder(args);
  8. // Add services to the container.
  9. builder.Services.AddDbContext<BRDbContext>(config =>
  10. //config.UseSqlServer(builder.Configuration.GetConnectionString("Default")));
  11. config.UseSqlite("Data source=BlackRock.db"));
  12. builder.Services.AddScoped<IGenerator, PdfGenerator>();
  13. builder.Services.AddScoped<IUsersRepository,UsersRepository>();
  14. builder.Services.AddScoped<IUnitOfWork,UnitOfWork>();
  15. builder.Services.AddCors();
  16. builder.Services.AddControllers();
  17. builder.Services.AddAutoMapper(typeof(Profiler));
  18. // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
  19. builder.Services.AddEndpointsApiExplorer();
  20. builder.Services.AddSwaggerGen();
  21. builder.Services.AddMediatR(typeof(Program));
  22. var app = builder.Build();
  23. // Configure the HTTP request pipeline.
  24. app.UseCors(options =>
  25. options.AllowAnyHeader()
  26. .AllowAnyMethod()
  27. .AllowAnyOrigin()
  28. );
  29. if (app.Environment.IsDevelopment())
  30. {
  31. app.UseSwagger();
  32. app.UseSwaggerUI();
  33. }
  34. app.UseHttpsRedirection();
  35. app.UseAuthorization();
  36. app.MapControllers();
  37. app.Run();