I am working on reading data from Table Storage in my Azure Function. I have created HttpTrigger function with in Table Storage binding. Project is using storage package:
"WindowsAzure.Storage": "8.0.0"
and binding:
{
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in"
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"name": "metadataTable",
"type": "table",
"direction": "in",
"tableName": "metadata",
"connection": "StorageConnectionString",
"partitionkey": "some_partition_key"
}
],
"disabled": false
}
Having code generated by template I have added new in parameter:
#r "Microsoft.WindowsAzure.Storage"
using System;
using System.Net;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req,
IQueryable<MetadataTable> metadataTable, TraceWriter log)
{
.....
}
public class MetadataTable: TableEntity
{
public MetadataTable():base() { }
public MetadataTable(string partitionkey, string rowkey):base(partitionkey,rowkey) {}
public string Data { get; set; }
}
During save and run process I am getting compile error:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.HttpTriggerCSharp1'. Microsoft.Azure.WebJobs.Host: GenericArguments[0], 'Submission#0+MetadataTable', on 'Microsoft.Azure.WebJobs.Host.Tables.TableAttributeBindingProvider+TableToIQueryableConverter
1[TElement]' violates the constraint of type 'TElement'. mscorlib: GenericArguments[0], 'Submission#0+MetadataTable', on 'Microsoft.Azure.WebJobs.Host.Tables.TableAttributeBindingProvider+TableToIQueryableConverter
1[TElement]' violates the constraint of type parameter 'TElement'.
Can anyone help me with this or meet same error?