c# - Topshelf windows service, Structure map - > achieve per request object lifecycle for timer elapsed event -


i have windows service application hosted topshelf. initializing structure map container once, when service started. have timer, scheduled tasks triggered on each timer elapsed event. have "per request " object creation have same instances of initialized objects durring 1 timer tick, , dispose them when job finished. on next tick of timer have new object instances (e.g. objects dbcontext ef.. ). how can achieve structure map possible?

i think you're looking nested container:

http://structuremap.github.io/the-container/nested-containers/

the naive implementation pass application's container elapsed event handler, call getnestedcontainer() on it, , dispose of nested container before handler exits.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -