using Microsoft.Extensions.DependencyInjection;
namespace OpenIddict.Core;
///
/// Exposes a method allowing to resolve an application store.
///
public class OpenIddictApplicationStoreResolver : IOpenIddictApplicationStoreResolver
{
private readonly IServiceProvider _provider;
public OpenIddictApplicationStoreResolver(IServiceProvider provider)
=> _provider = provider ?? throw new ArgumentNullException(nameof(provider));
///
/// Returns an application store compatible with the specified application type or throws an
/// if no store can be built using the specified type.
///
/// The type of the Application entity.
/// An .
public IOpenIddictApplicationStore Get() where TApplication : class
=> _provider.GetService>() ??
throw new InvalidOperationException(SR.GetResourceString(SR.ID0228));
}