Idea to make IWindsorInstaller more useful

97 views
Skip to first unread message

Gian Marco Gherardi

unread,
Mar 22, 2010, 5:14:53 PM3/22/10
to castle-pro...@googlegroups.com
To make complex component registration i often use a class that inplements IWindsorInstaller.
However this can cause monolithic compilations, for example:
  • App.exe
    • References
      • CustomInstaller.dll
    • class Program
      • Ioc = new WindsorContainer();
      • Ioc.Install(new CustomInstaller());
  • CustomInstaller.dll
    • References
      • ExternalLib.dll
    • class CustomInstaller : IWindsorInstaller
The monolitic compilation is caused by:
App.exe =depends on=> CustomInstaller.dll =depends on=> ExternalLib.dll

To break monolithic compilation i do the following trick
  • App.config
    • <component id="installer" service="Castle.Windsor.IWindsorInstaller, Castle.Windsor" type="CustomInstaller.CustomInstaller, CustomInstaller" />
  • class Program
    • Ioc = new WindsorContainer(new XmlInterpreter());
    • Ioc.Install(Ioc.ResolveAll<IWindsorInstaller>());
It would be nice to have this trick done automatically by WindsorContainer


--
Gian Marco Gherardi

Krzysztof Koźmic

unread,
Mar 22, 2010, 5:27:47 PM3/22/10
to Castle Project Development List
http://castle.uservoice.com/forums/38955-windsor-v3/suggestions/540047-expose-iwindsorinstallers-via-xml-config?ref=title

On Mar 22, 10:14 pm, Gian Marco Gherardi


<gianmarco.ghera...@gmail.com> wrote:
>  To make complex component registration i often use a class that inplements
> IWindsorInstaller.
> However this can cause monolithic compilations, for example:
>

>    - App.exe
>       - References
>          - CustomInstaller.dll
>       - class Program
>          - Ioc = new WindsorContainer();
>          - Ioc.Install(new CustomInstaller());
>       - CustomInstaller.dll
>       - References
>          - ExternalLib.dll
>       - class CustomInstaller : IWindsorInstaller


>
> The monolitic compilation is caused by:
> App.exe =depends on=> CustomInstaller.dll =depends on=> ExternalLib.dll
>
> To break monolithic compilation i do the following trick
>

>    - App.config
>       - <component id="installer" service="Castle.Windsor.IWindsorInstaller,


>       Castle.Windsor" type="CustomInstaller.CustomInstaller, CustomInstaller" />

>    - class Program
>       - Ioc = new WindsorContainer(new XmlInterpreter());
>       - Ioc.Install(Ioc.ResolveAll<IWindsorInstaller>());

SimoneB

unread,
Mar 23, 2010, 4:57:59 PM3/23/10
to Castle Project Development List
Gianmarco, don't you still have to reference the project containing
the installer if you want its assembly in your app execution folder so
that windsor can pick it up?

On Mar 22, 10:14 pm, Gian Marco Gherardi
<gianmarco.ghera...@gmail.com> wrote:

>  To make complex component registration i often use a class that inplements
> IWindsorInstaller.
> However this can cause monolithic compilations, for example:
>

>    - App.exe
>       - References
>          - CustomInstaller.dll
>       - class Program
>          - Ioc = new WindsorContainer();
>          - Ioc.Install(new CustomInstaller());
>       - CustomInstaller.dll
>       - References
>          - ExternalLib.dll

>       - class CustomInstaller : IWindsorInstaller


>
> The monolitic compilation is caused by:
> App.exe =depends on=> CustomInstaller.dll =depends on=> ExternalLib.dll
>
> To break monolithic compilation i do the following trick
>

>    - App.config
>       - <component id="installer" service="Castle.Windsor.IWindsorInstaller,


>       Castle.Windsor" type="CustomInstaller.CustomInstaller, CustomInstaller" />

>    - class Program
>       - Ioc = new WindsorContainer(new XmlInterpreter());
>       - Ioc.Install(Ioc.ResolveAll<IWindsorInstaller>());

Gian Marco Gherardi

unread,
May 27, 2010, 8:32:06 AM5/27/10
to castle-pro...@googlegroups.com
Referencing project is just a way to accomplish that.
You can also use post build event or your build process can choose how to configure the application by dynamically select the assembly that contain IWindsorInstaller.

With the proposed feature all that solutions are viable.

--
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-devel?hl=en.




--
Gian Marco Gherardi
Reply all
Reply to author
Forward
0 new messages