From e798b344df78bd00f8bc4a70a650b13e0ea0af77 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Fri, 12 Jul 2019 17:20:05 -0500 Subject: [PATCH] add generic constraint --- src/FilterLists.Agent/Core/Urls/IUrlRepository.cs | 2 +- .../Infrastructure/FilterListsApi/UrlRepository.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FilterLists.Agent/Core/Urls/IUrlRepository.cs b/src/FilterLists.Agent/Core/Urls/IUrlRepository.cs index c6a55908d..cf69c6b7f 100644 --- a/src/FilterLists.Agent/Core/Urls/IUrlRepository.cs +++ b/src/FilterLists.Agent/Core/Urls/IUrlRepository.cs @@ -7,6 +7,6 @@ namespace FilterLists.Agent.Core.Urls { public interface IUrlRepository { - Task> GetAllAsync(CancellationToken cancellationToken); + Task> GetAllAsync(CancellationToken cancellationToken) where TModel : class, new(); } } \ No newline at end of file diff --git a/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs b/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs index 911d360b9..ccd7a3667 100644 --- a/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs +++ b/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs @@ -33,6 +33,7 @@ public UrlRepository(IFilterListsApiClient apiClient, IStringLocalizer> GetAllAsync(CancellationToken cancellationToken) + where TModel : class, new() { if (!EntityUrlsEndpoints.ContainsKey(typeof(TModel).Name)) throw new ArgumentException(_localizer["The type of TModel is not valid."]);