diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Indexing/TaxonomyIndex.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Indexing/TaxonomyIndex.cs index c061d7efd4c..10362b3b664 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Indexing/TaxonomyIndex.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Indexing/TaxonomyIndex.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json.Linq; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata; @@ -25,13 +23,12 @@ public class TaxonomyIndex : MapIndex public class TaxonomyIndexProvider : IndexProvider, IScopedIndexProvider { - private readonly IServiceProvider _serviceProvider; private readonly HashSet _ignoredTypes = new HashSet(); private IContentDefinitionManager _contentDefinitionManager; - public TaxonomyIndexProvider(IServiceProvider serviceProvider) + public TaxonomyIndexProvider(IContentDefinitionManager contentDefinitionManager) { - _serviceProvider = serviceProvider; + _contentDefinitionManager = contentDefinitionManager; } public override void Describe(DescribeContext context) @@ -50,9 +47,6 @@ public override void Describe(DescribeContext context) return null; } - // Lazy initialization because of ISession cyclic dependency - _contentDefinitionManager = _contentDefinitionManager ?? _serviceProvider.GetRequiredService(); - // Search for Taxonomy fields var fieldDefinitions = _contentDefinitionManager .GetTypeDefinition(contentItem.ContentType)