我有一个名为“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.
表中包含三个名为 SpaceId
、spaceid
和 SPACEID
的属性是完全有效的。
就命名实体属性的指南而言,据我所知,没有。这完全取决于您想要如何创建模型。您可以设计模型并根据您认为合适的方式命名属性,存储客户端库将相应地命名属性。
关于c# - Azure 表查询在更改大小写时返回空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40870542/