Ste*_*cke 10 c# linq azure azure-table-storage
我正在尝试处理在添加新属性之前插入Azure表存储的记录.在LINQ的支持是有限的,我努力得到这个工作.
如何使用LINQ(或其他方法)过滤Azure表以仅记录缺少给定实体的属性?
我在Azure函数中编写它,并且在尝试字段的默认值时,此处的行计数返回0.
#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
}
Run Code Online (Sandbox Code Playgroud)
r.Category is nothing 生成编译错误String.IsNullOrEmpty(r.Category) 返回它不受支持r.Category == null 返回错误的请求!r.Category.HasValue 生成编译错误,因为它是一个字符串| 归档时间: |
|
| 查看次数: |
1469 次 |
| 最近记录: |