Created
December 6, 2012 23:48
-
-
Save emiaj/4229493 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class CustomSparkActivator: IActivator | |
| { | |
| private readonly ISparkViewEngine _engine; | |
| public AlsSparkActivator(ISparkViewEngine engine) | |
| { | |
| _engine = engine; | |
| } | |
| public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) | |
| { | |
| ((SparkSettings) _engine.Settings).SetAutomaticEncoding(false); | |
| } | |
| } |
This file contains hidden or 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
| [Policy] | |
| public class CustomSparkPolicy: IConfigurationAction | |
| { | |
| public void Configure(BehaviorGraph graph) | |
| { | |
| var activators = graph.Services.ServicesFor<IActivator>().ToList(); | |
| var activator = ObjectDef.ForType<CustomSparkActivator>(); | |
| activators.Insert(activators.FindIndex(x => x.Type == typeof(SparkPrecompiler)), activator); | |
| graph.Services.Clear(typeof (IActivator)); | |
| activators.Each(x => graph.Services.AddService(typeof (IActivator), x)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment