Overriding Part Rendering with Adapters

Adapters allow you to override rendering of a part type with custom code. You can use Adapters if the view engines don't meet your needs. Adapters are commonly used in situations where the views need to be completely embedded within the project assembly, or for extremely dynamic or flexible parts. 

  • Use MvcAdapter to handle parts rendered in the Mvc or Dinamico frameworks. 
  • Use XXX (TODO) to handle parts rendered in the WebForms framework.

Example Adapter

[Adapts(typeof(NewsList))]
public class NewsListAdapter : MvcAdapter
{
    public override void RenderTemplate(System.Web.Mvc.HtmlHelper html, N2.ContentItem model)
    {
        html.ViewContext.Writer.Write( /** write HTML here **/ );
    }
}