gpt4 book ai didi

c# - Azure 表随机返回 null 值

转载 作者:行者123 更新时间:2023-11-30 14:34:41 24 4
gpt4 key购买 nike

我有下一个 C# 代码片段:

        var results = from g in this.context.MyStorageEventTable
where g.PartitionKey == partitionKey
&& g.EventType == "MyEvent"
select g;
var ev = results.FirstOrDefault();

它对 Azure 表进行查询。该表包含超过 20000 个实体。问题在于,有时变量 ev 具有空值,有时具有实体对象。这是随机发生的。我知道该对象存在于表中,因此空值是错误的行为。为什么会发生这种情况?谢谢!

最佳答案

尝试results.AsTableServiceQuery().FirstOrDefault()。如果有效,则问题在于连续 token 随查询返回,表明有更多数据,但您没有发出后续查询来跟踪该连续 token 并获取其余数据。您应该始终使用 AsTableServiceQuery() 来免费获取后续 token 。

关于c# - Azure 表随机返回 null 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13630682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com