Last active
October 20, 2016 12:28
-
-
Save jammykam/631f66902babd10ea4377552e95ee0a5 to your computer and use it in GitHub Desktop.
Custom Sitecore ConfigReader to allow setting custom include folder locations
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 System.Configuration; | |
using System.Xml; | |
using Sitecore; | |
using Sitecore.Configuration; | |
using Sitecore.Diagnostics; | |
namespace MyProject.Custom | |
{ | |
class ConfigReader : Sitecore.Configuration.ConfigReader | |
{ | |
protected override void LoadAutoIncludeFiles(XmlNode element) | |
{ | |
Assert.ArgumentNotNull((object)element, "element"); | |
base.LoadAutoIncludeFiles(element); | |
string customFolder = ConfigurationManager.AppSettings["Sitecore.Include.Custom"]; | |
ConfigPatcher configPatcher = this.GetConfigPatcher(element); | |
this.LoadAutoIncludeFiles(configPatcher, MainUtil.MapPath(customFolder)); | |
} | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<configSections> | |
<section name="sitecore" type="MyProject.Custom.ConfigReader, MyProject.Custom" /> | |
... | |
</configSections> | |
<appSettings> | |
<add key="Sitecore.Include.Custom" value="/App_Config/Custom_Include" /> | |
... | |
</appSettings> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment