Skip to content

Instantly share code, notes, and snippets.

View cassidydotdk's full-sized avatar

Mark Cassidy cassidydotdk

  • Cassidy Consult
  • Kiel, Germany
View GitHub Profile
@cassidydotdk
cassidydotdk / gist:519dee612ca4683a18303298a429715c
Created August 15, 2016 12:26
Controller Factory Handling - Sitecore 8.1 and Castle Windsor
using System.Web.Mvc;
using Castle.Windsor;
using Sitecore.Mvc.Controllers;
using Sitecore.Mvc.Pipelines.Loader;
using Sitecore.Pipelines;
using Interfaces.Managers.Windsor;
using ControllerBuilder = System.Web.Mvc.ControllerBuilder;
namespace Website
{
@cassidydotdk
cassidydotdk / RenderItem.cs
Created August 11, 2016 09:03
Quickly render a Sitecore Controller Rendering, using given Item as Datasource
public virtual HtmlString RenderItem(Item item, string controller, string action)
{
Assert.ArgumentNotNull(item, "item");
Assert.ArgumentNotNullOrEmpty(controller, "controller");
Assert.ArgumentNotNullOrEmpty(action, "action");
var r = new Rendering();
r.DataSource = item.Paths.FullPath;
using (RenderingContext.EnterContext(r))
{
@cassidydotdk
cassidydotdk / SetupIoc.config
Created May 18, 2016 01:45
Setup Castle Windsor for Sitecore 8.1
<?xml version="1.0"?>
<configuration>
<sitecore>
<pipelines>
<initialize>
<processor type="Website.SetupIoc, Website" />
</initialize>
</pipelines>
</sitecore>
</configuration>