从配置中读取Azure功能设置

mat*_*uma 3 azure azure-functions

我正在使用Azure Functions with Attributes来定义功能.

public static class PostPublishTimerTrigger
{
    [FunctionName("PostPublishTimerTrigger")]
    public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
        TraceWriter log,
        [Queue("post-published")] ICollector<string> postPublishedQueue)
    {
          // Additional code here
    }
}
Run Code Online (Sandbox Code Playgroud)

有没有办法拉出0 */5 * * * *配置设置的时间表,无论是Configuration Manager或者Environment Variables

谢谢!

Mik*_*kov 7

是的,你可以做到

[TimerTrigger("%schedule%")]
Run Code Online (Sandbox Code Playgroud)

然后添加一个名为schedulevalue 的设置0 */5 * * * *