Merge pull request #5339 from Bond-009/hasproviderids

Revert breaking change to HasProviderId

(cherry picked from commit e858e5f0b8)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Claus Vium
2021-03-02 09:35:51 +01:00
committed by Joshua M. Boniface
parent 2d88b8346d
commit 20810eedbe
2 changed files with 65 additions and 0 deletions

View File

@@ -9,6 +9,33 @@ namespace MediaBrowser.Model.Entities
/// </summary>
public static class ProviderIdsExtensions
{
/// <summary>
/// Checks if this instance has an id for the given provider.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The of the provider name.</param>
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, string name)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
return instance.ProviderIds?.ContainsKey(name) ?? false;
}
/// <summary>
/// Checks if this instance has an id for the given provider.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, MetadataProvider provider)
{
return instance.HasProviderId(provider.ToString());
}
/// <summary>
/// Gets a provider id.
/// </summary>