I'm attempting to process records that were inserted into Azure Table Storage prior to the addition of a new attribute. The LINQ support is limited and I'm struggling to get this to work.
How would one use LINQ (or another method) to filter an Azure Table to just records missing an attribute for a given entity?
Sample Code
I'm writing it in an Azure Function, and the row count here returns 0, when attempting a default value for the field.
#r "Microsoft.WindowsAzure.Storage"
using System.Net;
using Microsoft.WindowsAzure.Storage.Table;
public static HttpResponseMessage Run(HttpRequestMessage req, IQueryable<ts_webhit> inTable, TraceWriter log)
{
IEnumerable<ts_webhit> recs = (from r in inTable
where "2016-11-21 12:45" == r.PartitionKey
&& "" == r.Category //The filter I need to run
select r);
log.Info($"{recs.Count()}");
return req.CreateResponse(HttpStatusCode.OK, recs.ToList());
}
public class ts_webhit : TableEntity
{
public string Category { get; set; } = ""; //Attempting a default value
}
Some candidate filters that didn't work
r.Category is nothing
generates a compilation errorString.IsNullOrEmpty(r.Category)
returns that it's not supportedr.Category == null
returns a bad request!r.Category.HasValue
generates a compilation error as it's a string