Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing taxonomy recipes #3253

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -25,13 +23,12 @@ 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(IServiceProvider serviceProvider)
public TaxonomyIndexProvider(IContentDefinitionManager contentDefinitionManager)
{
_serviceProvider = serviceProvider;
_contentDefinitionManager = contentDefinitionManager;
}

public override void Describe(DescribeContext<ContentItem> context)
Expand All @@ -50,9 +47,6 @@ 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