Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created December 6, 2012 23:48
Show Gist options
  • Select an option

  • Save emiaj/4229493 to your computer and use it in GitHub Desktop.

Select an option

Save emiaj/4229493 to your computer and use it in GitHub Desktop.
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);
}
}
[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