Skip to content
janjongboom edited this page Aug 16, 2011 · 6 revisions

Adding the reference

First add a reference to Moth.Core to your MVC project.

Registering in Global.asax

On top of the RegisterRoutes method, add the following line:

MothRouteFactory.RegisterRoutes(RouteTable.Routes);

If using MVC 3, add the following line to the RegisterGlobalFilters method:

// to make sure that Moth can post-process all requests, add a global filter
// this doesn't enable output caching by default, so no danger
filters.Add(new MothAction());

MVC 2 only: Add to controller

As MVC 2 doesn't support global filters, you will have to add the following attribute to every controller in your project. You can also create a BaseController that has this attribute, and let all the other controllers inherit from this base class:

[MothAction]
public class SomeController : Controller

Register in the web.config

To add support for the Moth methods in your views, add the following line to your web.config, under the <namespaces> section (f.e. \\system.web.webPages.razor\pages\namespaces):

<add namespace="Moth.Core"/>

Clone this wiki locally