Hi,

I am working on the port of a project based on .Net 1.1 with Castle,
NHibernate, Nano / Pico Containers and MVP architecture to .Net 4,
updating Castle and NHibernate and using Windsor instead of Nano /
Pico containers.

Things start to work finally, however I am puzzled by the component
registration on Windsor.

I tried several ways.

If I register the components one by one paying attention to the
registration order everything is fine.
However I did that just for the components needed to start the
program, doing that for all the classes would be extremely time
consuming.

I tried therefore several approaches to fluent registration:

container is an instance of IWindsorContainer.


container.Register(AllTypes.Pick().FromAssembly(Assembly.GetExecutingAssembly()).WithService.FirstInterface())
container.Register(AllTypes.FromThisAssembly().Pick().WithService.DefaultInterface())
container.Register(AllTypes.FromAssembly(System.Reflection.Assembly.GetExecutingAssembly).Pick())

 
container.Register(AllTypes.FromThisAssembly().Where(Component.IsInNamespace("MyProgram.UI.Views.Interfaces")))
container.Register(AllTypes.FromThisAssembly().BasedOn(Of
Views.Interfaces.IView))

and some other variants, but I suppose you got the point.

No matter which one I use, I always get those side effects:

* all components that have an event on theyr interface are registered
multiple times: it seems that events are treated as  distinct
components.

* because of the previous issue, Windsor says that some components can
be misconfigured, and those components exposing events are indeed
waiting for system.Object and System.Intptr to be registered.

* when I try to resolve components registered with fluent interface I
often get errors about the component that cannot be found. Here maybe
I am missing something, since docs about Windsor often say that I am
supposed to call .Resolve() only once. In my app instead I call
Resolve at startup to open the main form. Every menu item in main form
fires a different resolve that creates a specific presenter for the
proper form to be called.
I am not sure that this is the way in which I am supposed to use
Windsor.

At the moment the main issue of course is that not every component
registered using fluent methods can be properly resolved, and this
impacts about 650 components of my 1.050 components application.

Any help would be greatly appreciated.

Regards.

Luca




-- 
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