diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 66de080a39..5e4217cd54 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Entities /// /// Class BaseItem /// - public abstract class BaseItem : IHasProviderIds, IHasLookupInfo + public abstract class BaseItem : IHasProviderIds, IHasLookupInfo, IEquatable { /// /// The supported image extensions @@ -2914,5 +2914,17 @@ namespace MediaBrowser.Controller.Entities public static readonly IReadOnlyCollection DisplayExtraTypes = new[] { Model.Entities.ExtraType.BehindTheScenes, Model.Entities.ExtraType.Clip, Model.Entities.ExtraType.DeletedScene, Model.Entities.ExtraType.Interview, Model.Entities.ExtraType.Sample, Model.Entities.ExtraType.Scene }; public virtual bool SupportsExternalTransfer => false; + + /// + public override bool Equals(object obj) + { + return obj is BaseItem baseItem && this.Equals(baseItem); + } + + /// + public bool Equals(BaseItem item) => Object.Equals(Id, item?.Id); + + /// + public override int GetHashCode() => HashCode.Combine(Id); } }