Added RedirectUsingNamedRoute
[castle.git] / Samples / MindDump / Castle.Applications.MindDump / MindDumpContainer.cs
blobedc406138b2479ed6d8f741955c6870ad3b7f51e
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Applications.MindDump
17 using Castle.Windsor;
18 using Castle.Windsor.Configuration.Interpreters;
19 using Castle.Facilities.AutomaticTransactionManagement;
20 using Castle.Facilities.NHibernateIntegration;
21 using Castle.Applications.MindDump.Dao;
22 using Castle.Applications.MindDump.Services;
23 using Castle.Applications.MindDump.Presentation.Controllers;
24 using Castle.Applications.MindDump.Presentation.Filters;
25 using Castle.MonoRail.WindsorExtension;
27 public class MindDumpContainer : WindsorContainer
29 public MindDumpContainer() : this(new XmlInterpreter("../app_config.xml"))
33 public MindDumpContainer(XmlInterpreter interpreter) : base(interpreter)
35 Init();
38 public void Init()
40 RegisterFacilities();
41 RegisterComponents();
42 SubcribeForEvents();
45 private void RegisterFacilities()
47 AddFacility("rails", new RailsFacility());
48 AddFacility("nhibernate", new NHibernateFacility());
49 AddFacility("transaction", new TransactionFacility());
52 protected void RegisterComponents()
54 AddComponent("event.channel", typeof(IMindDumpEventPublisher),
55 typeof(MindDumpEventChannel));
57 AddComponent("author.dao", typeof(AuthorDao));
58 AddComponent("blog.dao", typeof(BlogDao));
59 AddComponent("post.dao", typeof(PostDao));
60 AddComponent("authentication", typeof(AuthenticationService));
61 AddComponent("account", typeof(AccountService));
62 AddComponent("encryption", typeof(EncryptionService));
63 AddComponent("blogService", typeof(BlogService));
65 AddComponent("auth.filter", typeof(AuthenticationCheckFilter));
66 AddComponent("auth.attempt.filter", typeof(AuthenticationAttemptFilter));
67 AddComponent("print.filter", typeof(PrintableFilter));
69 AddComponent("intro.controller", typeof(IntroController));
70 AddComponent("account.controller", typeof(AccountController));
71 AddComponent("blogs.controller", typeof(BlogController));
72 AddComponent("maintenance.controller", typeof(MaintenanceController));
75 protected void SubcribeForEvents()
77 AddComponent("blog.creator.subscriber", typeof(BlogControllerCreatorSubscriber));
79 IMindDumpEventPublisher channel =
80 (IMindDumpEventPublisher) this[typeof(IMindDumpEventPublisher)];
82 channel.AddSubcriber(
83 (IMindDumpEventSubscriber) this[typeof(BlogControllerCreatorSubscriber)]);