Minor fixes as per PR#3852 discussion
This commit is contained in:
@@ -127,12 +127,8 @@ namespace Umbraco.Web.Runtime
|
|||||||
composition.Container.RegisterUmbracoControllers(typeLoader, GetType().Assembly);
|
composition.Container.RegisterUmbracoControllers(typeLoader, GetType().Assembly);
|
||||||
composition.Container.EnableWebApi(GlobalConfiguration.Configuration);
|
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>()
|
composition.Container.RegisterCollectionBuilder<SearchableTreeCollectionBuilder>()
|
||||||
.Add(() => typeLoader.GetTypes<UmbracoApiController>().Where(x => x.Implements<ISearchableTree>()));
|
.Add(() => typeLoader.GetTypes<ISearchableTree>());
|
||||||
|
|
||||||
composition.Container.Register<UmbracoTreeSearcher>(new PerRequestLifeTime());
|
composition.Container.Register<UmbracoTreeSearcher>(new PerRequestLifeTime());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Umbraco.Core;
|
||||||
using Umbraco.Core.Composing;
|
using Umbraco.Core.Composing;
|
||||||
using Umbraco.Core.Services;
|
using Umbraco.Core.Services;
|
||||||
using Umbraco.Web.Trees;
|
using Umbraco.Web.Trees;
|
||||||
@@ -22,11 +24,11 @@ namespace Umbraco.Web.Search
|
|||||||
var appTrees = treeService.GetAll()
|
var appTrees = treeService.GetAll()
|
||||||
.OrderBy(x => x.SortOrder)
|
.OrderBy(x => x.SortOrder)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
var dictionary = new Dictionary<string, SearchableApplicationTree>();
|
var dictionary = new Dictionary<string, SearchableApplicationTree>(StringComparer.OrdinalIgnoreCase);
|
||||||
var searchableTrees = this.ToArray();
|
var searchableTrees = this.ToArray();
|
||||||
foreach (var appTree in appTrees)
|
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)
|
if (found != null)
|
||||||
{
|
{
|
||||||
dictionary[found.TreeAlias] = new SearchableApplicationTree(appTree.ApplicationAlias, appTree.Alias, found);
|
dictionary[found.TreeAlias] = new SearchableApplicationTree(appTree.ApplicationAlias, appTree.Alias, found);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Umbraco.Core.Composing;
|
||||||
using Umbraco.Web.Models.ContentEditing;
|
using Umbraco.Web.Models.ContentEditing;
|
||||||
|
|
||||||
namespace Umbraco.Web.Trees
|
namespace Umbraco.Web.Trees
|
||||||
{
|
{
|
||||||
public interface ISearchableTree
|
public interface ISearchableTree : IDiscoverable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The alias of the tree that the <see cref="ISearchableTree"/> belongs to
|
/// The alias of the tree that the <see cref="ISearchableTree"/> belongs to
|
||||||
|
|||||||
Reference in New Issue
Block a user