Ninject basically has 5 scope options.
TransientScope - the one you use means that a new instance is created for each request
SingletonScope - only one instance is created
ThreadScope - only one instance per thread is created
RequestScope - only one instance is created for HttpRequest
Custom - you provide a scope object
If you are creating a web application, you can simply specify .InRequestScope() If it is a Windows application, you can specify .InThreadScope()
Finally, if you have to specify a hybrid (I'm not quite sure how it works in the map structure), you can do .InScope(ctx => HttpRequest.Current != null ? HttpRequest.Current : Thread.CurrentThread)
Vadim source share