5 using Castle
.Core
.Configuration
;
6 using Castle
.MonoRail
.Framework
.Configuration
;
7 using Castle
.MonoRail
.Framework
.Extensions
.ExceptionChaining
;
8 using Castle
.MonoRail
.Framework
.Internal
;
9 using Castle
.MonoRail
.Framework
.Views
.Aspx
;
10 using Castle
.MonoRail
.Framework
.Views
.NVelocity
;
11 using Castle
.MonoRail
.WindsorExtension
;
15 public class Global
: System
.Web
.HttpApplication
, IContainerAccessor
17 private static WindsorContainer container
;
19 public void MonoRail_Configure(IMonoRailConfiguration config
)
21 config
.ControllersConfig
.AddAssembly(typeof(Global
).Assembly
);
22 config
.ViewEngineConfig
.ViewPathRoot
= Path
.Combine(AppDomain
.CurrentDomain
.BaseDirectory
, "Views");
23 config
.ViewEngineConfig
.ViewEngines
.Add(new ViewEngineInfo(typeof(NVelocityViewEngine
), false));
24 config
.ViewEngineConfig
.ViewEngines
.Add(new ViewEngineInfo(typeof(WebFormsViewEngine
), false));
26 config
.ExtensionEntries
.Add(new ExtensionEntry(typeof(ExceptionChainingExtension
), null));
28 MutableConfiguration configSection
= new MutableConfiguration("monorail");
29 IConfiguration exceptionNode
= configSection
.Children
.Add(new MutableConfiguration("exception"));
31 exceptionNode
.Children
.Add(new MutableConfiguration("handler")).Attributes
["type"] = typeof(LocalExceptionFilterHandler
).FullName
;
33 config
.ConfigurationSection
= configSection
;
36 public void Application_OnStart()
38 container
= new WindsorContainer();
39 container
.AddFacility("rails", new RailsFacility());
41 container
.AddComponentEx
<HomeController
>().WithName("home.controller").Register();
42 container
.AddComponentEx
<AccCreationWizard
>().WithName("acc.creation.wizard").Register();
43 container
.AddComponentEx
<Home2Controller
>().WithName("home2.controller").Register();
46 public void Application_OnEnd()
51 #region IContainerAccessor implementation
53 public IWindsorContainer Container
55 get { return container; }