我对 DateTimeOffset 列的 Linq 查询总是抛出 InvalidTimeZoneException。数据似乎是正确的。知道发生了什么吗?
细节:
Oracle Column: CREATED_DATETIME TIMESTAMP(0) WITH TIME ZONE
EF MAPPING: public Nullable<System.DateTimeOffset> CREATED_DATETIME { get; set; }
DataAccess: ODP.net Oracle.DataAccess
Data Sample: (Timezone column available but not used)
CREATED_DATETIME TIMEZONE_NAME
8/16/2013 5:06:05 PM +00:00 US/Central
8/16/2013 5:35:06 PM +00:00 US/Mountain
代码:
var q = from isr in pc.ISRs
select isr.CREATED_DATETIME;
try
{
DateTimeOffset? value = q.First();
}
catch (InvalidTimeZoneException tze)
{
throw new ApplicationException(tze.Message);
}
catch (Exception e)
{
throw new ApplicationException(e.Message);
}
var orders = from o in q select o;