Minor fixes as per PR#3852 discussion

This commit is contained in:
Stephan
2018-12-19 16:00:29 +01:00
parent 7cdbe39ce5
commit 5593d49719
3 changed files with 8 additions and 9 deletions

View File

@@ -127,12 +127,8 @@ namespace Umbraco.Web.Runtime
composition.Container.RegisterUmbracoControllers(typeLoader, GetType().Assembly);
composition.Container.EnableWebApi(GlobalConfiguration.Configuration);
//we aren't scanning for ISearchableTree since that is not IDiscoverable, instead we'll just filter what we've
//already scanned since all of our ISearchableTree is of type UmbracoApiController and in most cases any developers'
//own trees they want searched will also be of type UmbracoApiController. If a developer wants to replace one of ours
//then they will have to manually register/replace.
composition.Container.RegisterCollectionBuilder<SearchableTreeCollectionBuilder>()
.Add(() => typeLoader.GetTypes<UmbracoApiController>().Where(x => x.Implements<ISearchableTree>()));
.Add(() => typeLoader.GetTypes<ISearchableTree>());
composition.Container.Register<UmbracoTreeSearcher>(new PerRequestLifeTime());

View File

@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Services;
using Umbraco.Web.Trees;
@@ -22,11 +24,11 @@ namespace Umbraco.Web.Search
var appTrees = treeService.GetAll()
.OrderBy(x => x.SortOrder)
.ToArray();
var dictionary = new Dictionary<string, SearchableApplicationTree>();
var dictionary = new Dictionary<string, SearchableApplicationTree>(StringComparer.OrdinalIgnoreCase);
var searchableTrees = this.ToArray();
foreach (var appTree in appTrees)
{
var found = searchableTrees.FirstOrDefault(x => x.TreeAlias == appTree.Alias);
var found = searchableTrees.FirstOrDefault(x => x.TreeAlias.InvariantEquals(appTree.Alias));
if (found != null)
{
dictionary[found.TreeAlias] = new SearchableApplicationTree(appTree.ApplicationAlias, appTree.Alias, found);

View File

@@ -1,9 +1,10 @@
using System.Collections.Generic;
using Umbraco.Core.Composing;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Trees
{
public interface ISearchableTree
public interface ISearchableTree : IDiscoverable
{
/// <summary>
/// The alias of the tree that the <see cref="ISearchableTree"/> belongs to