1

Given that:

kernel.Bind<IClientFactory>()
  .ToProvider<ClientFactoryProvider>()
  .InSingletonScope();

kernel.Bind<IClient>()
  .ToProvider<ClientProvider>()
  .InRequestScope();

public class ClientProvider : Provider<IClient>
{
   private readonly IClientFactory _factory;

   public ClientProvider(IClientFactory factory)
   {
      _factory = factory;
   }

   protected override IClient CreateInstance(IContext context)
   {
       return _factory.Create();
   }
}

And that IClient is IDisposable.

The problem is that Dispose it not being called at the end of request. When using factory methods, everything works. When creating a wrapper for IClient (pass-thru), it works too.

Any ideias why?

To be clearer, IClient actually is IRedisClient and IClientFactory is IRedisClientsManager, both from ServiceStack.

Walter Macambira
  • 2,574
  • 19
  • 28

0 Answers0