Merge branch 'j2/ajout_repo' of https://10.4.0.131/gitea/DI1-P4-E1/Webzine into j2/feat/repository-commentaire
This commit is contained in:
@@ -36,6 +36,7 @@ try
|
||||
builder.Services.AddScoped<IStyleRepository, DbStyleRepository>();
|
||||
builder.Services.AddScoped<IArtisteRepository, DbArtisteRepository>();
|
||||
builder.Services.AddScoped<ICommentaireRepository, DbCommentaireRepository>();
|
||||
builder.Services.AddScoped<DbEntityRepository>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -45,13 +46,21 @@ try
|
||||
//builder.Services.AddScoped<ICommentaireRepository, LocalCommentaireRepository>();
|
||||
}
|
||||
|
||||
|
||||
// https://learn.microsoft.com/fr-fr/aspnet/core/performance/response-compression?view=aspnetcore-10.0#configuration
|
||||
// Ajoute le service de compression des réponses HTTP pour réduire la taille des données envoyées au client et améliorer les performances de l'application.
|
||||
builder.Services.AddResponseCompression();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<WebzineDbContext>();
|
||||
db.Database.EnsureDeleted();
|
||||
db.Database.EnsureCreated();
|
||||
var repo = scope.ServiceProvider.GetRequiredService<DbEntityRepository>();
|
||||
repo.SeedBaseDeDonnees();
|
||||
}
|
||||
|
||||
app.UseResponseCompression();
|
||||
|
||||
// Active la possibilite de servir des fichiers statiques presents dans
|
||||
@@ -65,12 +74,6 @@ try
|
||||
},
|
||||
});
|
||||
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<WebzineDbContext>();
|
||||
db.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
// Active le middleware permettant le routage des requetes entrantes.
|
||||
app.UseRouting();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user