Skip to content
smithc edited this page Aug 21, 2015 · 5 revisions

Welcome to the Jabberwocky wiki!

Quickstart

If you are starting a new project, you will want to download the Jabberwocky packages from the Velir Nuget feed.

If you haven't yet set that up, you'll want to go to Visual Studio -> Tools -> Options -> NuGet Package Manager -> Package Sources

Then you'll want to add 'http://nuget.velir.com/nuget' as a feed (you can also name the feed 'Velir').

If you're starting a new MVC project, you can start by just including the Jabberwocky.Glass.Autofac.Mvc package into your website project. If you're not using MVC, you can include the Jabberwocky.Glass.Autofac project instead.

You will also want to pull in the Glass.Mapper.Sc.CastleWindsor package. This will allow you to setup your Glass Models and configure the attribute loader in the GlassMapperScCustom.cs file.

Note: You'll need to select 'Include Pre-Release' in the Nuget Package manager when searching for the Jabberwocky packages, as they are not 'stable' just yet.

Notice that in either case, we're going to assume you'll be using the common stack of Glass.Mapper and Autofac.

The first thing that you'll want to do is create a new folder in the root of your Website project, called 'App_Start'. In this folder, you'll want to create a new class, called AutofacConfig.

You can use the following as a template:

public class AutofacConfig
{
	public static void Start()
	{
		var builder = new ContainerBuilder();

			builder.RegisterGlassServices();
			builder.RegisterCacheServices();
			builder.RegisterProcessors(Assembly.Load("YOURPROJECT.Library"));
			builder.RegisterGlassMvcServices("YOURPROJECT.Web");
			builder.RegisterGlassFactory("YOURPROJECT.Library");
			builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
			builder.RegisterControllers(Assembly.GetExecutingAssembly());

			// Custom Registrations

			// This is necessary to 'seal' the container, and make it resolvable from the AutofacStartup.ServiceLocator singleton
			IContainer container = builder.Build();
			container.RegisterContainer();

			// Create the dependency resolver.
			var resolver = new AutofacWebApiDependencyResolver(container);

			// Configure Web API with the dependency resolver.
			GlobalConfiguration.Configuration.DependencyResolver = resolver;

			DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
	}
}
Clone this wiki locally