-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+semver:breaking - refactors to support more customisation options du…
…ring the sitemap creation process, now requires explicit introduction of application event handler for Umbraco support
- Loading branch information
Showing
10 changed files
with
114 additions
and
55 deletions.
There are no files selected for viewing
Binary file not shown.
26 changes: 12 additions & 14 deletions
26
sample/SitemapifyUmbracoSample/Code/SitemapifyApplicationEventHandler.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Xml.Linq; | ||
using Sitemapify; | ||
using Sitemapify.Providers; | ||
using Sitemapify.Providers.Impl; | ||
using Sitemapify.Config; | ||
using Sitemapify.Umbraco; | ||
using Umbraco.Core; | ||
using Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix; | ||
using Sitemapify.Umbraco.Events; | ||
|
||
namespace SitemapifyUmbracoSample.Code | ||
{ | ||
public class SitemapifyApplicationEventHandler : ApplicationEventHandler | ||
public class MySitemapifyUmbracoContentProvider : SitemapifyUmbracoContentProvider | ||
{ | ||
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | ||
protected override Uri GetBaseUrl(Uri baseUri) | ||
{ | ||
Configure.With(config => config.UsingContentProvider(new SitemapifyUmbracoContentProvider())); | ||
return new Uri("https://github.com/stormid/sitemapify", UriKind.Absolute); | ||
} | ||
} | ||
|
||
protected override bool ExecuteWhenApplicationNotConfigured { get; } = false; | ||
protected override bool ExecuteWhenDatabaseNotConfigured { get; } = false; | ||
public class SitemapifyApplicationEventHandler : AbstractSitemapifyApplicationEventHandler | ||
{ | ||
protected override void ConfigureWith(ISitemapifyConfigurer configure) | ||
{ | ||
configure.UsingContentProvider(new MySitemapifyUmbracoContentProvider()); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Sitemapify.Umbraco/Events/AbstractSitemapifyApplicationEventHandler.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Sitemapify.Config; | ||
using Umbraco.Core; | ||
|
||
namespace Sitemapify.Umbraco.Events | ||
{ | ||
public abstract class AbstractSitemapifyApplicationEventHandler : ApplicationEventHandler | ||
{ | ||
protected sealed override void ApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | ||
{ | ||
base.ApplicationInitialized(umbracoApplication, applicationContext); | ||
} | ||
|
||
protected sealed override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | ||
{ | ||
base.ApplicationStarted(umbracoApplication, applicationContext); | ||
} | ||
|
||
protected sealed override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | ||
{ | ||
Configure.With(ConfigureWith); | ||
} | ||
|
||
protected virtual void ConfigureWith(ISitemapifyConfigurer configure) | ||
{ | ||
configure.UsingContentProvider(new SitemapifyUmbracoContentProvider()); | ||
} | ||
|
||
protected sealed override bool ExecuteWhenApplicationNotConfigured { get; } = false; | ||
protected sealed override bool ExecuteWhenDatabaseNotConfigured { get; } = false; | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
src/Sitemapify.Umbraco/Events/SitemapifyApplicationEventHandler.cs
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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