I have the following code which tries to update the following entity class which happens to contain a DateTimeOffset, This however throws an NotImplementedException. Has anybody else seen this?
[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();
}
When trying to do an update when calling UpdateCollectorStateEntityInTableStore I get a StorageException with Message = "NotImplemented". Do I have any other options other than serializing\deserializing DateTimeOffset to string ?
As mentioned by Brendan, because DateTimeOffset is not a supported data type in Azure Table Storage, you're getting this error. A few things you could do are:
String or DateTime type property instead of DateTimeOffset.ReadEntity and WriteEntity methods.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With