using System; namespace Quadarax.Foundation.Core.Data.Entity { public class NoKey : IEquatable { public Guid Hash { get; } public NoKey() { Hash = Guid.NewGuid(); } public bool Equals(NoKey other) { if (other == null) return false; return Hash == other.Hash; } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; return Equals((NoKey)obj); } public override int GetHashCode() { return Hash.GetHashCode(); } public static bool operator ==(NoKey left, NoKey right) { return Equals(left, right); } public static bool operator !=(NoKey left, NoKey right) { return !Equals(left, right); } } }