#region ========================================================================= USING =====================================================================================
using Lumina.Plugins.Calibre.Core;
using Lumina.Plugins.Contracts.Core.Metadata;
using Microsoft.Extensions.DependencyInjection;
using System;
#endregion
namespace Lumina.Plugins.Calibre.Common.DependencyInjection;
///
/// Provides extension methods for registering the Calibre metadata and artwork providers.
///
internal static class CalibreServices
{
///
/// Registers the Calibre book metadata provider, associated with the plugin that provides it.
///
/// The service collection to register the services into.
/// The unique identifier of the plugin that provides the metadata.
/// The service collection, for chaining.
internal static IServiceCollection AddCalibreBookMetadataProvider(this IServiceCollection services, Guid pluginId)
{
ArgumentNullException.ThrowIfNull(services);
// Register the metadata provider as a keyed by pluginId transient service, so it can be resolved specifically among other IMetadataProvider implementations.
services.AddKeyedTransient(pluginId);
return services;
}
///
/// Registers the Calibre artwork provider, associated with the plugin that provides it.
///
/// The service collection to register the services into.
/// The unique identifier of the plugin that provides the artwork.
/// The service collection, for chaining.
internal static IServiceCollection AddCalibreArtworkProvider(this IServiceCollection services, Guid pluginId)
{
ArgumentNullException.ThrowIfNull(services);
// Register the artwork provider as a keyed by pluginId transient service, so it can be resolved specifically among other IArtworkProvider implementations.
services.AddKeyedTransient(pluginId);
return services;
}
}