Oh, that was a mistake in writing.
// That was my code:
ILogManager logger = _container.Resolve<ILogManager>();
//But I have found the mitake already. I habe to register the logger
against the first interface. Like this:
_container.Register(AllTypes.FromAssemblyNamed(asm).BasedOn<ILogManager>().WithService.FirstInterface().If(t
=>
t.FullName.Contains(xmlConfig.loggerName)));
//Now it works :)
//Thaks for your time
On 15 Jun., 10:50, Ken Egozi <[email protected]> wrote:
> in your sample: _container.Resolve<LogManager>
>
> you should resolve by the service type (probably ILogManager) and not by
> implementation
>
> Ken
> Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.idcc.co.il-
> הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
>
> On Wed, Jun 15, 2011 at 11:43 AM, Marvin <[email protected]>wrote:
>
> > Hallo @ all!
> > I am a newbie at castle windsor and have problems to resolve an
> > object.
>
> > My code:
> > ...
> > ...
> > //this woks
> > foreach (String asm in assemblies)
> > {
>
> > _container.Register(AllTypes.FromAssemblyNamed(asm).BasedOn<ILogManager>().If(t
> > =>
>
> > t.FullName.Contains(xmlConfig.loggerName)));
> > }
> > //after that loop, there is only one component registered (Name:
> > "TextLogManager")
>
> > //Now I try to resolve:
> > ILogManager logger = _container.Resolve<LogManager>();
> > //This does not work. There occours the exception:
> > //"No component for supporting the service ILogManager was found"
> > //Where is the mistake??
>
> > // Thanks for the help...
> > // Marvin
>
> > --
> > 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.