Yes, we call explicitly Resolve().

It's a bit complicated:
- in a production scenario, component A is a client which Subscribe()
to a WCF server. The server can resolve the reference of A using WCF
features (OperationContext.Current.GetCallbackChannel)
- in an integration test scenario - which is the one i'm talking about
- we bypass the WCF stack (no WCF proxies) and directly couple client
to server through IoC. The problem is that the server can no more
resolve the reference of the client using the WCF mechanism
(OperationContext.Current.GetCallbackChannel). To solve this problem,
we inject a special integration proxy whose goal is to resolve the
reference of client A and give it to the server. Therefore we don't
have to change the implementation of the client component ...

So back to the problem:

Class A: IClient, IStartable
{
    private IServer _server;
    public A(IServer server) { _server = server;}

    public void Start()
    {
        server.Subscribe();
    }
}

Class IntegrationProxyB: IServer
{
    public IntegrationProxyB(IServer realServer) {...}
    public void Subscribe()
    {
      IClient client = IoC.Resolve<Iclient>();   <= here is the
problem !
      realServer.SubscribeDirect(client);
    }
}

When IntegrationProxyB is invoked by A, the Resolve() does not return
the reference of A but creates a new one which is started again ...

Is it enough ? Thanks for your help.

Xavier

On Dec 2, 6:33 pm, Mauricio Scheffer <[email protected]>
wrote:
> Are you explicitly calling Resolve()? If so, why? Can you post some
> code?
>
> On Dec 2, 1:54 pm, Xavier <[email protected]> wrote:
>
> > Hi,
> > We are using the startable facility first to start components (:)) but
> > also because i thought it would allow us to postpone some actions
> > after a complete initialization.
>
> > We get a "strange" behaviour:
> > - when a startable singleton A is started (Start()), it invokes an
> > injected component B
> > - B also needs a reference to A and calls Resolve<A>() to get it
> > What happens is that a second instance of A is created and started.
> > Why ?
>
> > I know that A could give a reference of itself to B but ... i would
> > like to understand the startable feature et what goes wrong.
>
> > thks
> > Xavier
>
>

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