3
我有下面的代码,它尝试更新下面的实体类,它恰好包含DateTimeOffset,但是会引发NotImplementedException。有其他人看过吗?使用DateTimeOffset更新Azure表TableEntity抛出NotImplemented异常
[System.Data.Services.Common.DataServiceKey("PartitionKey", "RowKey")]
public sealed class CollectorStateEntity : TableEntity
{
public CollectorStateEntity()
{}
public CollectorStateEntity(string collectorName, string tenantInstance)
{
this.PartitionKey = tenantInstance;
this.RowKey = collectorName;
}
public DateTimeOffset StartingTime { get; set; }
}
public static void UpdateCollectorStateEntityInTableStore(string connectionString, string tableName, string tenantInstance, string collectorName)
{
// Get Access to the table
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
TableServiceContext serviceContext = tableClient.GetTableServiceContext();
CollectorStateEntity specificEntity =
(from e in serviceContext.CreateQuery<CollectorStateEntity>(tableName)
where e.PartitionKey == tenantInstance && e.RowKey == collectorName
select e).FirstOrDefault();
specificEntity.StartingTime = DateTimeOffset.Parse("01/27/2014 10:35:00 AM -08:00");
serviceContext.UpdateObject(specificEntity);
serviceContext.SaveChangesWithRetries();
}
当试图调用UpdateCollectorStateEntityInTableStore时做一个更新我得到消息=“NotImplemented”一StorageException。除序列化\将DateTimeOffset反序列化为字符串外,还有其他选项吗?
是否支持Azure的DateTimeOffset?根据http://msdn.microsoft.com/en-us/library/windowsazure/jj553018.aspx它不是? –
你是对的,但是插入和删除包含DateTimeOffset的实体工作正常,看起来团队只是没有实现更新。感谢指针。 – arunsun