Windsor is really just a thin wrapper around the Kernel. the kernel is
where all the work is done.
As for convention over configuration. this would be done using
AllTypes.Pick(). there is no convention for an xml document. for
example say you are using MR along with the NH facility your startup
code would look something like this
var controllerAssembly = typeof(AController).Assembly;
var serviceAssembly = typeof(AService).Assembly;
return new WindsorContainer(new XmlInterperter())
.AddFacility<NHibernateFacility>("nhibernate")
.AddFacility<MonorailFacility>()
.Register(AllTypes
.Of<Controller>()
.From(controllerAssembly)
.Configure(c=>c.Named(c.Implemention.Name.Replace
("Controller",""))
.Register(AllTypes
.Pick()
.From(serviceAssembly)
.Where(t=>t.NameSpace.StartsWith
("Name.Space.Services"))
.WithService.FirstInterface());
your config file would then have the facility configs for nh.
something like
<configuration>
<configSection>
<section name="Castle" type="..." />
<configSection>
<castle>
<facilities>
<facility id="nhibernate">
.... NH configuration attributes.
</facility>
</facilities>
</castle>
</configuration>
how this will all work.
the NH facility is given a key which pertains to the facility id in
the config file. This will get picked up because the windsor container
is using an xml interperter.
there are 2 register clauses.
the first will register all objects that inherit Controller and name
the kernel key to the name of concrete type without the word
Controller.
the second will register all objects in the namespace
Name.Space.Services and uses the first interface it implements as the
Service type.
On Aug 26, 2:13 pm, Uri Goldstein <[email protected]> wrote:
> OK,
>
> Looks like I should've spent a couple more minutes digging around. :)
>
> I now figure that the "conventional" usage for WindosrContainer would
> be:
>
> WindsorContainer windsorContainer = new WindsorContainer(new
> XmlInterpreter());
>
> And that this will fetch the DI configuration from app.config /
> web.config.
>
> Am I correct?
>
> Tx,
> urig
>
> On Aug 26, 8:50 pm, Uri Goldstein <[email protected]> wrote:
>
> > Hi,
>
> > Aiming for "convention over configuration" for the location of my
> > windsor configuration xml, I was thinking the most conventional way to
> > use the WindsorContainer might be to use the empty constructor,
> > assuming it looks for the xml from some predetermined location.
>
> > Am I correct in this assumption and where might this predetermined
> > location be?
>
> > BTW as far as I could find on the castle website, the WindsorContainer
> > class itself is poorly documented in comparison to its
> > interface:http://www.castleproject.org/container/documentation/trunk/
> > manual/windsortypedocs/Generated_IWindsorContainer.html
>
> > Thanks,
> > urig
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---