namespace OliverBooth.Data.Blog; /// /// Represents an author of a blog post. /// public sealed class Author : IEquatable { /// /// Gets or sets the email address of the author. /// /// The email address. public string? EmailAddress { get; set; } /// /// Gets the ID of the author. /// /// The ID. public int Id { get; private set; } /// /// Gets or sets the name of the author. /// /// The name. public string Name { get; set; } = string.Empty; public bool Equals(Author? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Id == other.Id; } public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is Author other && Equals(other); } public override int GetHashCode() { return Id; } }