ExecutionContext is available to functon parameters.
However, it is not available to other methods via dependency inject, including Functions' constructor, like below:
public class FunctionClass
{
IOtherClass _otherclass;
public FunctionClass(ExecutionContext context, //excetpion
IOtherClass otherclass) //excetpion
{
_otherclass = IOtherClass otherclass
}
[FunctionName("Car")]
public async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]
HttpRequest req, ExecutionContext context)
{
}
}
public class OtherClass:IOtherClass
{
public OtherClass(ExecutionContext context) //excetpion
{}
}
I need access to ExecutionContext.FunctionAppDirectory
, but don't want to pass ExecutionContext around, because want to use IoC instead.
Is there an alternative way to get the value of ExecutionContext.FunctionAppDirectory
?
VS 2017
Azure Functons 2.x