end of tp2

This commit is contained in:
2026-03-17 11:12:34 +01:00
parent d202d1541d
commit 90fcaca356
7 changed files with 76 additions and 40 deletions

View File

@@ -1,7 +1,5 @@
using AutoMapper;
using AutoMapper.EquivalencyExpression;
using BookHive;
using BookHive.MappingProfiles;
using BookHive.Repositories;
using FastEndpoints;
using FastEndpoints.Security;
@@ -38,16 +36,20 @@ builder.Services.AddScoped<LoanRepository>();
builder.Services.AddHttpContextAccessor();
MapperConfiguration mappingConfig = new(mc =>
builder.Services.AddAutoMapper(cfg =>
{
mc.AddCollectionMappers();
mc.AddProfile(new DtoToEntityMappings());
mc.AddProfile(new EntityToDtoMappings());
}, new LoggerFactory());
cfg.AddCollectionMappers();
}, typeof(Program).Assembly);
// MapperConfiguration mappingConfig = new(mc =>
// {
// mc.AddCollectionMappers();
// mc.AddProfile(new DtoToEntityMappings());
// mc.AddProfile(new EntityToDtoMappings());
// }, new LoggerFactory());
AutoMapper.IMapper mapper = mappingConfig.CreateMapper();
builder.Services.AddSingleton(mapper);
// AutoMapper.IMapper mapper = mappingConfig.CreateMapper();
// builder.Services.AddSingleton(mapper);
WebApplication app = builder.Build();
app.UseAuthentication()