fix : modification des classes d'extensions

API
Damien NORTIER 1 year ago
parent bb234e77ac
commit 89507e8088

@ -33,25 +33,67 @@ namespace ExtensionsClassLibrairie
=> a.ToModel().ToEntity();
// equality protocols
public static bool Equals(this Administrator a1, Administrator a2)
public static bool Equals(Administrator a1, Administrator a2)
=> a1.Username == a2.Username;
// reuse other methods
public static bool Equals(this Administrator a1, AdministratorDto a2)
=> a1.Equals(a2.ToModel());
public static bool Equals(this Administrator a1, AdministratorEntity a2)
=> a1.Equals(a2.ToModel());
public static bool Equals(this AdministratorDto a1, Administrator a2)
=> a1.ToModel().Equals(a2);
public static bool Equals(this AdministratorDto a1, AdministratorDto a2)
=> a1.ToModel().Equals(a2.ToModel());
public static bool Equals(this AdministratorDto a1, AdministratorEntity a2)
=> a1.ToModel().Equals(a2.ToModel());
public static bool Equals(this AdministratorEntity a1, Administrator a2)
=> a1.ToModel().Equals(a2);
public static bool Equals(this AdministratorEntity a1, AdministratorDto a2)
=> a1.ToModel().Equals(a2.ToModel());
public static bool Equals(this AdministratorEntity a1, AdministratorEntity a2)
=> a1.ToModel().Equals(a2.ToModel());
public static bool Equals(Administrator a1, AdministratorDto a2)
=> Equals(a1, a2.ToModel());
public static bool Equals(Administrator a1, AdministratorEntity a2)
=> Equals(a1, a2.ToModel());
public static bool Equals(AdministratorDto a1, Administrator a2)
=> Equals(a1.ToModel(), a2);
public static bool Equals(AdministratorDto a1, AdministratorDto a2)
=> Equals(a1.ToModel(), a2.ToModel());
public static bool Equals(AdministratorDto a1, AdministratorEntity a2)
=> Equals(a1.ToModel(), a2.ToModel());
public static bool Equals(AdministratorEntity a1, Administrator a2)
=> Equals(a1.ToModel(), a2);
public static bool Equals(AdministratorEntity a1, AdministratorDto a2)
=> Equals(a1.ToModel(), a2.ToModel());
public static bool Equals(AdministratorEntity a1, AdministratorEntity a2)
=> Equals(a1.ToModel(), a2.ToModel());
/// <summary>
/// equality protocol for an administrator
/// </summary>
/// <param name="a">the administrator</param>
/// <param name="o">an object</param>
/// <returns>true if the administrator and the object are sames, false otherwise</returns>
public static bool Equals(this Administrator a, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Administrator)) return Equals(a, (Administrator)o);
else if (o.GetType() == typeof(AdministratorEntity)) return Equals(a, ((AdministratorEntity)o));
else if (o.GetType() == typeof(AdministratorDto)) return Equals(a, (AdministratorDto)o);
return false;
}
/// <summary>
/// equality protocol for an administrator entity
/// </summary>
/// <param name="a">the administrator entity</param>
/// <param name="o">an object</param>
/// <returns>true if the administrator entity and the object are sames, false otherwise</returns>
public static bool Equals(this AdministratorEntity a, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Administrator)) return Equals(a, (Administrator)o);
else if (o.GetType() == typeof(AdministratorEntity)) return Equals(a, ((AdministratorEntity)o));
else if (o.GetType() == typeof(AdministratorDto)) return Equals(a, (AdministratorDto)o);
return false;
}
/// <summary>
/// equality protocol for an administrator dto
/// </summary>
/// <param name="a">the administrator dto</param>
/// <param name="o">an object</param>
/// <returns>true if the administrator dto and the object are sames, false otherwise</returns>
public static bool Equals(this AdministratorDto a, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Administrator)) return Equals(a, (Administrator)o);
else if (o.GetType() == typeof(AdministratorEntity)) return Equals(a, ((AdministratorEntity)o));
else if (o.GetType() == typeof(AdministratorDto)) return Equals(a, (AdministratorDto)o);
return false;
}
}
}

@ -53,5 +53,47 @@ namespace ExtensionsClassLibrairie
=> a1.ToModel().Equals(a2.ToModel());
public static bool Equals(this AnswerEntity a1, AnswerEntity a2)
=> a1.ToModel().Equals(a2.ToModel());
/// <summary>
/// equality protocol for an answer
/// </summary>
/// <param name="a">the answer</param>
/// <param name="o">an object</param>
/// <returns>true if the answer and the object are sames, false otherwise</returns>
public static bool Equals(this Answer a, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Answer)) return Equals(a, (Answer)o);
else if (o.GetType() == typeof(AnswerEntity)) return Equals(a, ((AnswerEntity)o));
else if (o.GetType() == typeof(AnswerDto)) return Equals(a, (AnswerDto)o);
return false;
}
/// <summary>
/// equality protocol for an answer entity
/// </summary>
/// <param name="a">the answer entity</param>
/// <param name="o">an object</param>
/// <returns>true if the answer entity and the object are sames, false otherwise</returns>
public static bool Equals(this AnswerEntity a, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Answer)) return Equals(a, (Answer)o);
else if (o.GetType() == typeof(AnswerEntity)) return Equals(a, ((AnswerEntity)o));
else if (o.GetType() == typeof(AnswerDto)) return Equals(a, (AnswerDto)o);
return false;
}
/// <summary>
/// equality protocol for an answer dto
/// </summary>
/// <param name="a">the answer dto</param>
/// <param name="o">an object</param>
/// <returns>true if the answer dto and the object are sames, false otherwise</returns>
public static bool Equals(this AnswerDto a, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Answer)) return Equals(a, (Answer)o);
else if (o.GetType() == typeof(AnswerEntity)) return Equals(a, ((AnswerEntity)o));
else if (o.GetType() == typeof(AnswerDto)) return Equals(a, (AnswerDto)o);
return false;
}
}
}

@ -53,5 +53,47 @@ namespace ExtensionsClassLibrairie
=> c1.ToModel().Equals(c2.ToModel());
public static bool Equals(this ChapterEntity c1, ChapterEntity c2)
=> c1.ToModel().Equals(c2.ToModel());
/// <summary>
/// equality protocol for a chapter
/// </summary>
/// <param name="c">the chapter</param>
/// <param name="o">an object</param>
/// <returns>true if the chapter and the object are sames, false otherwise</returns>
public static bool Equals(this Chapter c, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Chapter)) return Equals(c, (Chapter)o);
else if (o.GetType() == typeof(ChapterEntity)) return Equals(c, ((ChapterEntity)o));
else if (o.GetType() == typeof(ChapterDto)) return Equals(c, (ChapterDto)o);
return false;
}
/// <summary>
/// equality protocol for a chapter entity
/// </summary>
/// <param name="c">the chapter entity</param>
/// <param name="o">an object</param>
/// <returns>true if the chapter entity and the object are sames, false otherwise</returns>
public static bool Equals(this ChapterEntity c, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Chapter)) return Equals(c, (Chapter)o);
else if (o.GetType() == typeof(ChapterEntity)) return Equals(c, ((ChapterEntity)o));
else if (o.GetType() == typeof(ChapterDto)) return Equals(c, (ChapterDto)o);
return false;
}
/// <summary>
/// equality protocol for a chapter dto
/// </summary>
/// <param name="c">the chapter dto</param>
/// <param name="o">an object</param>
/// <returns>true if the chapter dto and the object are sames, false otherwise</returns>
public static bool Equals(this ChapterDto c, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Chapter)) return Equals(c, (Chapter)o);
else if (o.GetType() == typeof(ChapterEntity)) return Equals(c, ((ChapterEntity)o));
else if (o.GetType() == typeof(ChapterDto)) return Equals(c, (ChapterDto)o);
return false;
}
}
}

@ -54,5 +54,47 @@ namespace ExtensionsClassLibrairie
=> l1.ToModel().Equals(l2.ToModel());
public static bool Equals(this LobbyEntity l1, LobbyEntity l2)
=> l1.ToModel().Equals(l2.ToModel());
/// <summary>
/// equality protocol for a lobby
/// </summary>
/// <param name="l">the lobby</param>
/// <param name="o">an object</param>
/// <returns>true if the lobby and the object are sames, false otherwise</returns>
public static bool Equals(this Lobby l, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Lobby)) return Equals(l, (Lobby)o);
else if (o.GetType() == typeof(LobbyEntity)) return Equals(l, ((LobbyEntity)o));
else if (o.GetType() == typeof(LobbyDto)) return Equals(l, (LobbyDto)o);
return false;
}
/// <summary>
/// equality protocol for a lobby entity
/// </summary>
/// <param name="l">the lobby entity</param>
/// <param name="o">an object</param>
/// <returns>true if the lobby entity and the object are sames, false otherwise</returns>
public static bool Equals(this LobbyEntity l, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Lobby)) return Equals(l, (Lobby)o);
else if (o.GetType() == typeof(LobbyEntity)) return Equals(l, ((LobbyEntity)o));
else if (o.GetType() == typeof(LobbyDto)) return Equals(l, (LobbyDto)o);
return false;
}
/// <summary>
/// equality protocol for a lobby dto
/// </summary>
/// <param name="l">the lobby dto</param>
/// <param name="o">an object</param>
/// <returns>true if the lobby dto and the object are sames, false otherwise</returns>
public static bool Equals(this LobbyDto l, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Lobby)) return Equals(l, (Lobby)o);
else if (o.GetType() == typeof(LobbyEntity)) return Equals(l, ((LobbyEntity)o));
else if (o.GetType() == typeof(LobbyDto)) return Equals(l, (LobbyDto)o);
return false;
}
}
}

@ -53,5 +53,47 @@ namespace ExtensionsClassLibrairie
=> p1.ToModel().Equals(p2.ToModel());
public static bool Equals(this PlayerEntity p1, PlayerEntity p2)
=> p1.ToModel().Equals(p2.ToModel());
/// <summary>
/// equality protocol for a player
/// </summary>
/// <param name="p">the player</param>
/// <param name="o">an object</param>
/// <returns>true if the player and the object are sames, false otherwise</returns>
public static bool Equals(this Player p, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Player)) return Equals(p, (Player)o);
else if (o.GetType() == typeof(PlayerEntity)) return Equals(p, ((PlayerEntity)o));
else if (o.GetType() == typeof(PlayerDto)) return Equals(p, (PlayerDto)o);
return false;
}
/// <summary>
/// equality protocol for a player entity
/// </summary>
/// <param name="p">the player entity</param>
/// <param name="o">an object</param>
/// <returns>true if the player entity and the object are sames, false otherwise</returns>
public static bool Equals(this PlayerEntity p, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Player)) return Equals(p, (Player)o);
else if (o.GetType() == typeof(PlayerEntity)) return Equals(p, ((PlayerEntity)o));
else if (o.GetType() == typeof(PlayerDto)) return Equals(p, (PlayerDto)o);
return false;
}
/// <summary>
/// equality protocol for a player dto
/// </summary>
/// <param name="p">the player dto</param>
/// <param name="o">an object</param>
/// <returns>true if the player dto and the object are sames, false otherwise</returns>
public static bool Equals(this PlayerDto p, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Player)) return Equals(p, (Player)o);
else if (o.GetType() == typeof(PlayerEntity)) return Equals(p, ((PlayerEntity)o));
else if (o.GetType() == typeof(PlayerDto)) return Equals(p, (PlayerDto)o);
return false;
}
}
}

@ -65,5 +65,47 @@ namespace ExtensionsClassLibrairie
=> q1.ToModel().Equals(q2.ToModel());
public static bool Equals(this QuestionEntity q1, QuestionEntity q2)
=> q1.ToModel().Equals(q2.ToModel());
/// <summary>
/// equality protocol for a question
/// </summary>
/// <param name="q">the question</param>
/// <param name="o">an object</param>
/// <returns>true if the question and the object are sames, false otherwise</returns>
public static bool Equals(this Question q, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Question)) return Equals(q, (Question)o);
else if (o.GetType() == typeof(QuestionEntity)) return Equals(q, ((QuestionEntity)o));
else if (o.GetType() == typeof(QuestionDto)) return Equals(q, (QuestionDto)o);
return false;
}
/// <summary>
/// equality protocol for a question entity
/// </summary>
/// <param name="q">the question entity</param>
/// <param name="o">an object</param>
/// <returns>true if the question entity and the object are sames, false otherwise</returns>
public static bool Equals(this QuestionEntity q, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Question)) return Equals(q, (Question)o);
else if (o.GetType() == typeof(QuestionEntity)) return Equals(q, ((QuestionEntity)o));
else if (o.GetType() == typeof(QuestionDto)) return Equals(q, (QuestionDto)o);
return false;
}
/// <summary>
/// equality protocol for a question dto
/// </summary>
/// <param name="q">the question dto</param>
/// <param name="o">an object</param>
/// <returns>true if the question dto and the object are sames, false otherwise</returns>
public static bool Equals(this QuestionDto q, object? o)
{
if (o == null) return false;
if (o.GetType() == typeof(Question)) return Equals(q, (Question)o);
else if (o.GetType() == typeof(QuestionEntity)) return Equals(q, ((QuestionEntity)o));
else if (o.GetType() == typeof(QuestionDto)) return Equals(q, (QuestionDto)o);
return false;
}
}
}
Loading…
Cancel
Save