当创建一个使用Azure的表存储作为输入绑定,并试图检索多个实体,而不是只是一个单一的enntity我得到以下错误的Azure的功能:
Error:
Function ($ScheduleTrigger) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.myTimerTrigger'. Microsoft.Azure.WebJobs.Host: GenericArguments[0], 'Submission#0+Task', on Microsoft.Azure.WebJobs.Host.Tables.TableExtension+TableToIQueryableConverter`1[ TElement]' violates the constraint of type 'TElement'. mscorlib: GenericArguments[0], 'Submission#0+Task', on 'Microsoft.Azure.WebJobs.Host.Tables.TableExtension+TableToIQueryableConverter`1 [TElement]' violates the constraint of type parameter 'TElement'.
Session Id: f4a00564b4864fb3a131557dd45924c7
Timestamp: 2017-09-05T07:48:09.738Z
我使用的,在这种情况下的码,C#计时器触发如下:
using System;
public class Task
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public DateTime Timestamp { get; set; }
public string Name { get; set; }
}
public static async Task Run(TimerInfo myTimer, IQueryable<Task> inputTable, TraceWriter log)
{
foreach (var task in inputTable) {
log.Info($"Processing task '{task.Name}' at: {DateTime.Now}");
}
log.Info($"Timer trigger executed at: {DateTime.Now}");
}