C# Azure表查询在更改大小写时返回空值
我有一张蓝色的桌子,叫做“Motion”。该表包含以下字段:C# Azure表查询在更改大小写时返回空值,c#,azure,azure-table-storage,C#,Azure,Azure Table Storage,我有一张蓝色的桌子,叫做“Motion”。该表包含以下字段: 分区键 罗基 spaceid 阅读时间 该外壳显示在VisualStudio的云资源管理器中。我使用类“MotionModel”查询此表 我得到的值是正确的。但是,如果我将此更改为 public class MotionData : TableEntity { public MotionData() { } public string SpaceId {get; s
- 分区键
- 罗基
- spaceid
- 阅读时间
public class MotionData : TableEntity
{
public MotionData() { }
public string SpaceId {get; set;}
public DateTime ReadingTime { get; set; }
}
我在ReadingTime中获取值,但SpaceId为null。
是否有关于命名TableEntity类的属性的指导原则?您看到的是预期的行为。Azure表实体属性区分大小写。由此: 属性名称是区分大小写的字符串,最大长度为255个字符 尺寸。属性名称应遵循C#标识符的命名规则 表中有三个名为
SpaceId
、SpaceId
和SpaceId
的属性是非常有效的
至于命名实体属性的指导原则,恐怕没有。这完全取决于您想要如何创建模型。您可以根据需要设计模型并命名属性,存储客户端库将相应地命名属性。正如Gaurav所提到的,这是预期的行为 我在ReadingTime中获取值,但SpaceId为空 ReadingTime值可以是“1/1/0001 12:00:00 AM”,它是为空DateTime显示的DateTime的最小值。它可能不是您设置的值。
由于Spaceid是字符串类型,因此没有显示空值。此线程是否有任何更新?
public class MotionData : TableEntity
{
public MotionData() { }
public string SpaceId {get; set;}
public DateTime ReadingTime { get; set; }
}