Castle.MonoRail.Framework.EngineContextModule.Init C# (CSharp) Method

Init() public method

Configures the framework, starts the services and application hooks.
public Init ( System.Web.HttpApplication context ) : void
context System.Web.HttpApplication
return void
		public void Init(HttpApplication context)
		{
			Application = context;

			if (context.Context.Error != null)
			{
				throw new Exception(
					"An exception happened on Global application or on a module that run before MonoRail's module. " + 
					"MonoRail will not be initialized and further requests are going to fail. " + 
					"Fix the cause of the error reported below.", context.Context.Error);
			}

			lock(initLock)
			{
				CreateAndStartContainer(context);
			}

			context.BeginRequest += new EventHandler(OnStartMonoRailRequest);
			context.AuthorizeRequest += new EventHandler(CreateControllerAndRunStartRequestFilters);

			SubscribeToApplicationHooks(context);
		}