From 5593d49719437f3ce4ccb3e4b3bc97da94139ff1 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 19 Dec 2018 16:00:29 +0100 Subject: [PATCH] Minor fixes as per PR#3852 discussion --- src/Umbraco.Web/Runtime/WebRuntimeComponent.cs | 6 +----- src/Umbraco.Web/Search/SearchableTreeCollection.cs | 8 +++++--- src/Umbraco.Web/Trees/ISearchableTree.cs | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs index ccd9a7ef7d..0d27253466 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs @@ -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() - .Add(() => typeLoader.GetTypes().Where(x => x.Implements())); + .Add(() => typeLoader.GetTypes()); composition.Container.Register(new PerRequestLifeTime()); diff --git a/src/Umbraco.Web/Search/SearchableTreeCollection.cs b/src/Umbraco.Web/Search/SearchableTreeCollection.cs index 81ee0a2898..38c329cafa 100644 --- a/src/Umbraco.Web/Search/SearchableTreeCollection.cs +++ b/src/Umbraco.Web/Search/SearchableTreeCollection.cs @@ -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(); + var dictionary = new Dictionary(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); diff --git a/src/Umbraco.Web/Trees/ISearchableTree.cs b/src/Umbraco.Web/Trees/ISearchableTree.cs index 4146bfaf45..3d82d548c8 100644 --- a/src/Umbraco.Web/Trees/ISearchableTree.cs +++ b/src/Umbraco.Web/Trees/ISearchableTree.cs @@ -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 { /// /// The alias of the tree that the belongs to