One thing to note however is that many facilities expect to be
registered before any components are registered (such as startable) or
they wont work properly and others such as NHibernate facility need to
read from the configuration when registered.  See my tests in previous
post here
http://groups.google.com/group/castle-project-users/browse_thread/thread/2c6fe9f0ef659f53/179c027ec875b23b?lnk=gst&q=fluent+facilities#179c027ec875b23b

I eventually discovered there is one overload on the windsorcontainer
(kernel, installer) you can use to load the config without actually
installing the components it until after facilities are registered.
Here is the relevant extras to testfixture from previous post
mentioned above.

    public class SpecializedContainer : WindsorContainer
    {
        public static SpecializedContainer Create
(IConfigurationInterpreter interpreter)
        {
            var kernel = new DefaultKernel();
            var container = new SpecializedContainer(kernel, new
DefaultComponentInstaller());
            // load configuration file so that facilities can read
from it
            // but don't install any components yet
            interpreter.ProcessResource(interpreter.Source,
kernel.ConfigurationStore);
            // register facilities
            container.RegisterFacilities();
            // load components from config
            container.RunInstaller();
            // now do the fluent stuff
            container.RegisterComponents();

            return container;
        }

        // This is the only constructor that doe not actually run the
installer
        public SpecializedContainer(IKernel kernel,
IComponentsInstaller installer) : base(kernel, installer) { }

        public new void RunInstaller()
        {
            base.RunInstaller();
        }

        public void RegisterFacilities()
        {
            AddFacility<TestFacility>("testfacility");
        }
        public void RegisterComponents()
        {
            if (!Kernel.HasComponent("somecomponent"))
            {
                Register(Component.For<ISomeComponent>
().ImplementedBy<SomeComponent>().Named("somecomponent"));
            }
        }
    }

        [Test]
        public void TestSpecializedContainer()
        {
            var container = SpecializedContainer.Create(new
XmlInterpreter(ConfigFile));
            VerifyDesiredState(container);
        }



On Apr 13, 10:09 am, Germán Schuager <[email protected]> wrote:
> Thank you very much.
>
> On Mon, Apr 13, 2009 at 12:33 PM, Ayende Rahien <[email protected]> wrote:
>
> >http://ayende.com/Blog/archive/2008/12/31/didja-know-merging-windsor-...
>
> > On Mon, Apr 13, 2009 at 6:30 PM, Germán Schuager <[email protected]>wrote:
>
> >> How?
>
> >> On Mon, Apr 13, 2009 at 12:28 PM, Ayende Rahien <[email protected]>wrote:
>
> >>> yes
>
> >>> On Mon, Apr 13, 2009 at 6:15 PM, Germán Schuager 
> >>> <[email protected]>wrote:
>
> >>>> Hi,
>
> >>>> I'm using the fluent registration feature to scan several assemblies and
> >>>> register all the components that my application needs into the container.
>
> >>>> Now I'd like to specify in the configuration file some parameters values
> >>>> that needs to be injected into some components, is this possible?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to