Created
May 26, 2020 10:24
-
-
Save darrenferguson/f9fc0198cbee3d035dedd04e8ca005d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using log4net; | |
using Moriyama.Core.Routing.ContentFinders; | |
using Moriyama.Core.Routing.UrlProviders; | |
using System.Reflection; | |
using Umbraco.Core; | |
using Umbraco.Web.Routing; | |
namespace Moriyama.Core.Events | |
{ | |
public class UmbracoBooter : IApplicationEventHandler | |
{ | |
private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | |
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | |
{ | |
} | |
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | |
{ | |
} | |
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, | |
ApplicationContext applicationContext) | |
{ | |
Logger.Debug("Add Content Finders"); | |
//Here we are adding our own content finders which know about umbraco Hidden Folders. | |
ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByIdPath, UmbracoHiddenFolderChildrenContentFinder>(); | |
ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByIdPath, UmbracoHiddenFolderContentFinder>(); | |
//We can remove ContentFinderByNiceUrl because it's logic is covered in UmbracoHiddenFolderContentFinder which is registered above. | |
ContentFinderResolver.Current.RemoveType<ContentFinderByNiceUrl>(); | |
Logger.Debug("Add UrlProviders"); | |
UrlProviderResolver.Current.InsertType<UmbracoHiddenFolderUrlProvider>(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment