This project is read-only.

Setting up Growl in your ASP.Net Mvc application.

This page details how to get Growl running in your application.

Grab the most recent binaries

You can download the most recent Release or grab the application Source using Mercurial.

Reference the binaries in your application

When you pull in the binaries, you will need 3 of those binaries
  1. MvcContrib.dll
  2. GrowlForMvc.Library.Core.dll
  3. One of the GrowlForMvc.Addon dll files of your choice

You only need to reference the last of these two in your project, but you need to package all three in your deployment as GrowlForMvc requires MvcContrib.

Wire-up Application_Start in your Application class

Area Registration
Important! Do this before controller registration

Area Registration.RegisterAllAreas();

Controller Registration with IoC

Because each IoC container does this slightly different, we'll focus on the commonality here. The IoC containers want to see a list of assemblies that they need to interrogate for 'Controller' implementations. You can grab the list of required assemblies from Growl using the following:

var growlAssemblies = GrowlConfig.ControllerAssemblies;

This line returns an array of assemblies. Add your local assembly or assemblies to this list and hand that list to your container.

Register Growl types with IoC

While there are two projects dedicated to the handling of this, they are IoC container specific. The following interfaces, implementations and lifetime scoping requirements are listed below:

Interface Concrete Type Scoping
IGrowlRecorder GrowlRecorder Http Request
IGrowlRenderer GrowlRenderer Http Request
ISession SessionWrapper Http Request
IScopedCache<string, IList<IGrowlMessage>> GrowlMessageCache(System.Web.Caching.Cache instance) Singleton

Generate Markup to Support Growling

In this section we discuss how to get the supporting javascript and css on your page to get growls working.

Attach the CSS
CSS references typically go before the </head> tag on your page. When you have identified the spot you would like on your page, use the following command

<% Html.RenderCssLink(); %>

Next Step - JQuery
Make sure the page you are hosting the growl messages has jquery linked before the Growl javascript tags.

Render Growl Javascript links

<% Html.RenderJsLink(); %>

Start Growling

You can now pass growl messages from your server side code by injecting the IGrowlRecorder into your code. A growl is registered by:

_growlRecorder.AddMessage(new GrowlMessage("Title", "Message"));

Last edited Jul 23, 2010 at 11:19 AM by sdhebert, version 5


No comments yet.