开发者

wcf - disposing proxies properly

I am using wcf 4 and trying to use some Ioc container to resolve service dependencies. I was looking at Castle Windsor and StructureMap. I haven't use any of them with wcf.

The scenario is that I have IService1 and Iservice2. Service1 is using service2:

public class Service1 : IService1
{
    public Service1(IService2 service2)
    {

    }
}

If I use WcfFacility from Castle with a transient lifecycle for service2 will it automatically dispose service2 after service1 is done with it(consider service1 a per-call instantiation for example)? And how exactly does that work internally. How is this done with structuremap?

Some sample code would be really ap开发者_StackOverflow社区preciated.


Yes, Windsor will do that for you out of the box. It's the default, you don't have to do anything. It tracks all disposable objects and their dependencies it creates and then disposes them as needed. Google "component burden" if you want the details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜