mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add generic constraint
This commit is contained in:
parent
9a524d574b
commit
e798b344df
2 changed files with 2 additions and 1 deletions
|
|
@ -7,6 +7,6 @@ namespace FilterLists.Agent.Core.Urls
|
|||
{
|
||||
public interface IUrlRepository
|
||||
{
|
||||
Task<IEnumerable<Uri>> GetAllAsync<TModel>(CancellationToken cancellationToken);
|
||||
Task<IEnumerable<Uri>> GetAllAsync<TModel>(CancellationToken cancellationToken) where TModel : class, new();
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ public UrlRepository(IFilterListsApiClient apiClient, IStringLocalizer<UrlReposi
|
|||
}
|
||||
|
||||
public async Task<IEnumerable<Uri>> GetAllAsync<TModel>(CancellationToken cancellationToken)
|
||||
where TModel : class, new()
|
||||
{
|
||||
if (!EntityUrlsEndpoints.ContainsKey(typeof(TModel).Name))
|
||||
throw new ArgumentException(_localizer["The type of TModel is not valid."]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue