azure-function-dependency-injection icon indicating copy to clipboard operation
azure-function-dependency-injection copied to clipboard

Singletons vs transient vs scoped

Open holgerleichsenring opened this issue 7 years ago • 2 comments

Is it possible to retrieve non scoped dependencies via the inject attribute? It looks like, the dependencies directly injected into the function are always scoped and will be destroyed after function execution had been left.

holgerleichsenring avatar Oct 30 '18 13:10 holgerleichsenring

Example @holgerleichsenring ?

PureKrome avatar Jan 08 '19 08:01 PureKrome

Hi PureKrome,

actually to be honest I just had a look onto the code. Maybe code changed meanwhile, I just had another look here. Scope is generated per function and services are resolved from service provider. Should work out, I guess. Still unsure about services that may last longer than a function call in case when a service lifecycle is not limited to function lifecycle.

Let me know your thoughts.

holgerleichsenring avatar Feb 04 '19 20:02 holgerleichsenring