[英]Is it possible to access any Azure Function trigger details/context in Startup.cs?
I have a few azure functions, they're in a .net core project which has a startup.cs class in which I register all of the dependencies.我有一些 azure 函数,它们位于一个 .net 核心项目中,该项目有一个 startup.cs 类,我在其中注册了所有依赖项。
This is all works fine, but I'd like some way of calling a common method regardless of which trigger was invoked.这一切正常,但无论调用哪个触发器,我都想要某种调用通用方法的方法。 But within that method I'd like to access details from some sort of context (?) to know which azure function's being called.但是在该方法中,我想从某种上下文 (?) 访问详细信息,以了解正在调用哪个 azure 函数。
This is based on the assumption that Startup.cs is called every time a function is.这是基于每次调用函数时都会调用 Startup.cs 的假设。
I'm aware of the FunctionInvocationFilterAttribute
but this is currently only in preview mode so I'm not permitted to use this.我知道FunctionInvocationFilterAttribute
但这目前仅处于预览模式,所以我不允许使用它。
Is it possible to access any Azure Function trigger details/context in Startup.cs?是否可以访问 Startup.cs 中的任何 Azure Function 触发器详细信息/上下文?
In short, it's impossible .简而言之,这是不可能的。
You will not be able to get the ExecutionContext
in startup.您将无法在启动时获得ExecutionContext
。 Because the ExecutionContext
enables interaction with the Azure Functions execution environment when a function call is made.因为ExecutionContext
在进行函数调用时启用与 Azure Functions 执行环境的交互。
However, in your function startup, your Azure Function is not yet processing an actual function call.但是,在函数启动时,Azure 函数尚未处理实际的函数调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.