17 lines
668 B
C#

namespace DigitalData.Core.DTO
{
/// <summary>
/// Represents a base Data Transfer Object (DTO) with an identifier.
/// </summary>
/// <typeparam name="TId">The type of the identifier.</typeparam>
/// <param name="Id">The identifier of the DTO.</param>
public record BaseDto<TId>(TId Id) where TId : notnull
{
/// <summary>
/// Returns the hash code for this instance, based on the identifier.
/// This override ensures that the hash code is derived consistently from the identifier.
/// </summary>
/// <returns>A hash code for the current object, derived from the identifier.</returns>
public override int GetHashCode() => Id.GetHashCode();
}
}