I want to inject a class into my module using the IOC framework in NancyFX, and I want that class to have access to the Context, just like the module does.
How would I do that?
The module has a property called Context, that doesn't seem to be injected (nor should it be, as it is the request state)... how does that work, and is that thread safe?
Thanks
Assuming you use the
DefaultNancyBootstrapper
as a base for your bootstrapper you register your dependency in your container on a per request basis by overridingConfigureRequestContainer
:If you use a different container, the implementation will differ slightly.