在天蓝色 table 存储中存储 DateTime.MinValue 的日期时间值失败

Storing a DateTime value of DateTime.MinValue in azure table storage fails

我在存储 nullDateTime.MinValueDateTime 值时遇到聚合异常。如何在 Azure table 存储中存储 acceptable 默认 DateTime 值?

  1. 来自 MSDN:

Edm.DateTime DateTime A 64-bit value expressed as Coordinated Universal Time (UTC). The supported DateTime range begins from 12:00 midnight, January 1, 1601 A.D. (C.E.), UTC. The range ends at December 31, 9999.

因此,您可以在 Azure 表中存储的最小 .Net DateTime 值是 new DateTime(1601, 1, 1)

但是DateTime.MinValue等于new DateTime(0001, 01, 01),所以不能存储。

  1. null 应该没问题,如果你的日期时间 属性 类型可以为 null (DateTime?).