From 6f2e2ed558721473d2ae88cac4daa2e0052ade8b Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Wed, 28 Apr 2021 15:23:57 +0200 Subject: [PATCH] Enable assembly scanning, combined with replaced open generics upfront --- .../Configuration/JsonApiApplicationBuilder.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs b/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs index b5ce25aa82..7907acc67b 100644 --- a/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs +++ b/src/JsonApiDotNetCore/Configuration/JsonApiApplicationBuilder.cs @@ -24,6 +24,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; namespace JsonApiDotNetCore.Configuration @@ -212,7 +213,7 @@ private void RegisterImplementationForOpenInterfaces(HashSet openGenericIn { Type implementationType = openGenericInterface.GetGenericArguments().Length == 1 ? intImplementation : implementation; - _services.AddScoped(openGenericInterface, implementationType); + _services.TryAddScoped(openGenericInterface, implementationType); } }