| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using BlackRock.Reporting.API.Core;
- using BlackRock.Reporting.API.Persistence;
- using BlackRock.Reporting.API.Profiles;
- using MediatR;
- using Microsoft.EntityFrameworkCore;
-
- var builder = WebApplication.CreateBuilder(args);
-
- // Add services to the container.
- builder.Services.AddDbContext<BRDbContext>(config =>
- //config.UseSqlServer(builder.Configuration.GetConnectionString("Default")));
- config.UseSqlite("Data source=BlackRock.db"));
- builder.Services.AddScoped<IGenerator, PdfGenerator>();
- builder.Services.AddScoped(typeof(IRepository < > ), typeof(Repository < > ));
- builder.Services.AddScoped<IUsersRepository,UsersRepository>();
- builder.Services.AddScoped<IUnitOfWork,UnitOfWork>();
- builder.Services.AddCors();
- builder.Services.AddControllers();
- builder.Services.AddAutoMapper(typeof(Profiler));
- // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
- builder.Services.AddEndpointsApiExplorer();
- builder.Services.AddSwaggerGen();
- builder.Services.AddMediatR(typeof(Program));
- var app = builder.Build();
-
- // Configure the HTTP request pipeline.
- app.UseCors(options =>
- options.AllowAnyHeader()
- .AllowAnyMethod()
- .AllowAnyOrigin()
- );
- if (app.Environment.IsDevelopment())
- {
- app.UseSwagger();
- app.UseSwaggerUI();
- }
- app.UseHttpsRedirection();
-
- app.UseAuthorization();
-
- app.MapControllers();
-
- app.Run();
|