Yeah, I know, I got burden by that myself on several occasions.
While the goal is noble (register more stuff in a single assembly scan)
the API does not follow principle of least surprise sadly, and I can't
think of a good, clean way, of making it obvious where you're making
logical AND (which is when you're using If() or Unless() methods). and
when you're doing "and also from that assembly I want that separate
batch of components".
Krzysztof
On 14/08/2011 12:12 PM, Shawn Hinsey wrote:
Got it, thanks for the help. This was driving me crazy.
2011/8/13 Krzysztof Koźmic<[email protected]>:
Where/BasedOn/Peek are logical ORs in this context, not ANDs
that's explained in the doco.
On 14/08/2011 12:09 PM, Shawn Hinsey wrote:
So to be clear, using Where precludes the use of the other calls?
2011/8/13 Krzysztof Koźmic<[email protected]>:
That's because this core is equivalent to the following:
Container.Register
(AllTypes.FromAssembly(myAssembly)
.Where(Component.IsInNamespace(myDesiredNamespace)));
Container.Register
(AllTypes.FromAssembly(myAssembly)
.BasedOn(typeof (MyServiceInterface))
.Configure(component =>
component.LifeStyle.Transient)
.WithService.AllInterfaces().WithService.Self());
This is a very common problem with the API and WIndsor 3 deprecates this
option (you will get a compiler warning).
On 14/08/2011 11:55 AM, Shawn Hinsey wrote:
Hello,
I have the following registration call.
Container.Register
(AllTypes.FromAssembly(myAssembly)
.Where(Component.IsInNamespace(myDesiredNamespace))
.BasedOn(typeof (MyServiceInterface))
.Configure(component =>
component.LifeStyle.Transient)
.WithService.AllInterfaces().WithService.Self());
But after this call, the container reports the lifestyle all of all of
these instances as undefined and defaulted to singleton, which is
causing problems due to their dependencies on transient components.
I am confident that this should work, based on the documentation and
my experience with Windsor, so am I overlooking here?
Thanks,
Shawn
--
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.
--
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.
--
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.