【发布时间】:2020-10-24 18:43:11
【问题描述】:
此代码直接来自 Visual Studio 2019 中的 Durable Function 启动
[FunctionName("Orchestrator_HttpStart")]
public static async Task<HttpResponseMessage> HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,
[DurableClient] IDurableOrchestrationClient starter,
ILogger log)
{
// Function input comes from the request content.
string instanceId = await starter.StartNewAsync("Orchestrator", null);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
}
IDurableOrchestationClient starter 和 ILogger log 的值来自哪里?由于这些参数不会在 HTTP 请求中传递,我假设幕后一定发生了一些 IoC 魔术,但我不完全确定它是什么/在哪里。
【问题讨论】:
-
你有没有查看这里的公开源代码github.com/Azure/azure-functions-host/tree/dev/src/…
标签: c# azure dependency-injection azure-functions azure-durable-functions