Очистка мусора

This commit is contained in:
Халимов Рустам
2026-03-15 21:36:49 +03:00
parent c14999d319
commit 893c9f2316
424 changed files with 689 additions and 493340 deletions
@@ -0,0 +1,43 @@
namespace Knot.Shared.Kernel;
/// <summary>
/// Базовый класс для всех сущностей в системе.
/// </summary>
/// <typeparam name="TId">Тип идентификатора сущности.</typeparam>
public abstract class Entity<TId> : IEquatable<Entity<TId>>
where TId : notnull
{
public TId Id { get; protected set; }
protected Entity(TId id)
{
Id = id;
}
public override bool Equals(object? obj)
{
return obj is Entity<TId> entity && Equals(entity);
}
public bool Equals(Entity<TId>? other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return Id.Equals(other.Id);
}
public static bool operator ==(Entity<TId>? left, Entity<TId>? right)
{
return Equals(left, right);
}
public static bool operator !=(Entity<TId>? left, Entity<TId>? right)
{
return !Equals(left, right);
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
}