Commande dotnet format
This commit is contained in:
@@ -5,8 +5,10 @@
|
||||
namespace Webzine.Repository
|
||||
{
|
||||
using System.Data.Common;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Webzine.EntitiesContext;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
@@ -17,7 +19,7 @@ namespace Webzine.Repository
|
||||
/// </summary>
|
||||
public class DbArtisteRepository : IArtisteRepository
|
||||
{
|
||||
private WebzineDbContext context;
|
||||
private readonly WebzineDbContext context;
|
||||
private readonly ILogger<LocalArtisteRepository> logger;
|
||||
|
||||
/// <summary>
|
||||
@@ -115,7 +117,7 @@ namespace Webzine.Repository
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<Artiste> FindAll()
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
// .AsNoTracking() rend la requête beaucoup plus rapide pour de la lecture
|
||||
var artistes = this.context.Artistes.AsNoTracking().ToList();
|
||||
@@ -127,15 +129,15 @@ namespace Webzine.Repository
|
||||
this.logger.LogError(ex, "Erreur lors de la récupération de tous les artistes.");
|
||||
return Enumerable.Empty<Artiste>(); // Retourne une liste vide au lieu de faire crash l'UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Update(Artiste artiste)
|
||||
{
|
||||
if (artiste == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(artiste));
|
||||
}
|
||||
{
|
||||
throw new ArgumentNullException(nameof(artiste));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Webzine.EntitiesContext;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Webzine.EntitiesContext;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
@@ -15,6 +15,7 @@ public class DbCommentaireRepository : ICommentaireRepository
|
||||
private readonly WebzineDbContext context;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DbCommentaireRepository"/> class.
|
||||
/// Initialisation de <see cref="DbCommentaireRepository"/>.
|
||||
/// </summary>
|
||||
/// <param name="logger">Le service de journalisation injecté pour suivre les opérations du repository.</param>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Webzine.EntitiesContext;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Webzine.EntitiesContext;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Webzine.Entity;
|
||||
|
||||
namespace Webzine.Repository
|
||||
namespace Webzine.Repository
|
||||
{
|
||||
using Webzine.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// Représente un entrepôt de données en mémoire (Mock) pour l'application.
|
||||
/// Cette classe simule une base de données en stockant les entités dans des listes statiques
|
||||
@@ -12,21 +12,21 @@ namespace Webzine.Repository
|
||||
/// <summary>
|
||||
/// Obtient ou définit la liste des artistes enregistrés.
|
||||
/// </summary>
|
||||
public List<Artiste> Artistes { get; set; } = new();
|
||||
public List<Artiste> Artistes { get; set; } = new ();
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit la liste des titres (morceaux) musicaux.
|
||||
/// </summary>
|
||||
public List<Titre> Titres { get; set; } = new();
|
||||
public List<Titre> Titres { get; set; } = new ();
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit la liste des styles musicaux disponibles.
|
||||
/// </summary>
|
||||
public List<Style> Styles { get; set; } = new();
|
||||
public List<Style> Styles { get; set; } = new ();
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit la liste des commentaires rédigés par les utilisateurs.
|
||||
/// </summary>
|
||||
public List<Commentaire> Commentaires { get; set; } = new();
|
||||
public List<Commentaire> Commentaires { get; set; } = new ();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
namespace Webzine.Repository
|
||||
{
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
@@ -15,9 +16,9 @@ namespace Webzine.Repository
|
||||
public class LocalArtisteRepository : IArtisteRepository
|
||||
{
|
||||
private readonly ILogger<LocalArtisteRepository> logger;
|
||||
//private readonly List<Artiste> artistes;
|
||||
private readonly InMemoryDataStore dataStore;
|
||||
|
||||
// private readonly List<Artiste> artistes;
|
||||
private readonly InMemoryDataStore dataStore;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocalArtisteRepository"/> class.
|
||||
@@ -28,7 +29,8 @@ namespace Webzine.Repository
|
||||
public LocalArtisteRepository(InMemoryDataStore dataStore, ILogger<LocalArtisteRepository> logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
//this.artistes = artistes;
|
||||
|
||||
// this.artistes = artistes;
|
||||
this.dataStore = dataStore;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@ namespace Webzine.Repository
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Initialise une classe <see cref="LocalCommentaireRepository"/> qui implémente l'interface <see cref="ICommentaireRepository"/> pour gérer les opérations liées aux commentaires.
|
||||
@@ -21,6 +23,7 @@ using Webzine.Repository.Contracts;
|
||||
private readonly InMemoryDataStore dataStore;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocalCommentaireRepository"/> class.
|
||||
/// Initialise une nouvelle instance du <see cref="LocalCommentaireRepository"/> .
|
||||
/// Est liée à un magasin de données en mémoire et utilise un logger pour enregistrer les opérations.
|
||||
/// </summary>
|
||||
@@ -55,7 +58,7 @@ using Webzine.Repository.Contracts;
|
||||
{
|
||||
var commentaire = this.dataStore.Commentaires.FirstOrDefault(c => c.IdCommentaire == idCommentaire);
|
||||
if (commentaire == null)
|
||||
{
|
||||
{
|
||||
return new Commentaire();
|
||||
}
|
||||
|
||||
@@ -94,4 +97,4 @@ using Webzine.Repository.Contracts;
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,8 @@ namespace Webzine.Repository;
|
||||
public class LocalStyleRepository : IStyleRepository
|
||||
{
|
||||
private readonly ILogger<LocalStyleRepository> logger;
|
||||
//private readonly List<Style> styles;
|
||||
|
||||
// private readonly List<Style> styles;
|
||||
private readonly InMemoryDataStore dataStore;
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user