Skip to content

Commit

Permalink
Revert "Fixing taxonomy recipes (#3253)"
Browse files Browse the repository at this point in the history
This reverts commit f82cf1d.
  • Loading branch information
sebastienros committed Mar 4, 2019
1 parent b555810 commit 8021824
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata;
Expand All @@ -23,12 +25,13 @@ public class TaxonomyIndex : MapIndex

public class TaxonomyIndexProvider : IndexProvider<ContentItem>, IScopedIndexProvider
{
private readonly IServiceProvider _serviceProvider;
private readonly HashSet<string> _ignoredTypes = new HashSet<string>();
private IContentDefinitionManager _contentDefinitionManager;

public TaxonomyIndexProvider(IContentDefinitionManager contentDefinitionManager)
public TaxonomyIndexProvider(IServiceProvider serviceProvider)
{
_contentDefinitionManager = contentDefinitionManager;
_serviceProvider = serviceProvider;
}

public override void Describe(DescribeContext<ContentItem> context)
Expand All @@ -47,6 +50,9 @@ public override void Describe(DescribeContext<ContentItem> context)
return null;
}

// Lazy initialization because of ISession cyclic dependency
_contentDefinitionManager = _contentDefinitionManager ?? _serviceProvider.GetRequiredService<IContentDefinitionManager>();

// Search for Taxonomy fields
var fieldDefinitions = _contentDefinitionManager
.GetTypeDefinition(contentItem.ContentType)
Expand Down

0 comments on commit 8021824

Please sign in to comment.