Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.