I am attempting to update an entry in Azure Table Storage. The function is:
public void SaveBug(DaBug bug)
{
bug.PartitionKey = "bugs";
bug.Timestamp = DateTime.UtcNow;
if (bug.RowKey == null || bug.RowKey == string.Empty)
{
bug.RowKey = Guid.NewGuid().ToString();
_context.AddObject(c_TableName, bug);
}
else
{
_context.AttachTo(c_TableName, bug);
_context.UpdateObject(bug);
}
_context.SaveChanges();
}
If it is a new entry (the "bug.RowKey == null" path), then it works fine. If it is an update to an existing entity, then the "AttachTo", and the "UpdateObject" calls work, but when it gets to "SaveChanges", it throws the "One of the request inputs not valid" exception.
The class that is being stored is:
[DataContract]
[DataServiceKey("RowKey")]
public class DaBug
{
[DataMember]
public bool IsOpen { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Description { get; set; }
[DataMember]
public string SubmittedBy { get; set; }
[DataMember]
public DateTime SubmittedDate { get; set; }
[DataMember]
public string RowKey { get; set; }
public DateTime Timestamp { get; set; }
public string PartitionKey { get; set; }
}
Does anyone know what the problem is?
Thanks for any help.