【发布时间】:2018-08-23 05:30:20
【问题描述】:
我正在开发一个与我的表通信并更新表中数据的 Azure 函数。最近发现Microsoft.WindowsAzure.Storage这个包现在只有Async函数了,对这些不太熟悉。
在我用于测试的函数中,如果行存在,我想返回 true,如果不存在,则返回 false。如果该行存在,它会工作,但如果该行不存在,程序会挂起(因为它正在等待响应)。
谁能帮帮我?
这是我的代码:
public static bool rowExists(CloudTable table, string city, string state)
{
TableOperation tOP = TableOperation.Retrieve<SickCity>(city, state);
Task<TableResult> result = table.ExecuteAsync(tOP);
if (result == null)
return false;
else
return true;
}
编辑:
这是我调用 rowExists 的地方
log.Info($"Does the row \"New York, NY\" exist? {rowExists(sickTable, "New York", "NY")}");
【问题讨论】:
标签: c# azure asynchronous azure-functions azure-table-storage