c# - Azure 表查询在更改大小写时返回空值

标签 c# azure azure-table-storage

我有一个名为“Motion”的 Azure 表。该表具有以下字段:

  • 分区键
  • 行键
  • 空间ID
  • 阅读时间

外壳是 Visual Studio 中的 Cloud Explorer 中显示的外壳。我使用类 "MotionModel"

查询此表
public class MotionData : TableEntity
    {
        public MotionData() { }

        public string spaceid {get; set;}

        public DateTime readingtime { get; set; }
    }

我正确地得到了值。但是,如果我将其更改为

public class MotionData : TableEntity
        {
            public MotionData() { }

            public string SpaceId {get; set;}

            public DateTime ReadingTime { get; set; }
        }

我在 ReadingTime 中获取值,但 SpaceId 为空。 是否有关于 TableEntity 类的属性命名的指南?

最佳答案

您所看到的是预期行为。 Azure 表实体属性区分大小写。从这里link :

Property names are case-sensitive strings up to 255 characters in size. Property names should follow naming rules for C# identifiers.

表中包含三个名为 SpaceIdspaceidSPACEID 的属性是完全有效的。

就命名实体属性的指南而言,据我所知,没有。这完全取决于您想要如何创建模型。您可以设计模型并根据您认为合适的方式命名属性,存储客户端库将相应地命名属性。

关于c# - Azure 表查询在更改大小写时返回空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40870542/

相关文章:

javascript - 在 Azure 中处理多个异步请求?

c# - 如何重置 Selenium 鼠标光标位置?

azure - 确定 Azure Log Analytics 工作区上设置的保留期

Azure批量插入-如何减少响应长度?

javascript - 无法将下一个js部署到azure

IoT 中心和诊断设置的 Azure 模板部署不起作用

azure - 为 Webhooks 注入(inject) Azure 表存储连接字符串

c# - 正确的 Json.net System.Object 往返?

c# - 转换为正确的日期时间

c# - 如何在 Windows 10 UWP 应用程序中播放 (MIDI) 声音?