我正在尝试更新Azure表存储中的条目。功能是:尝试更新Azure表存储时出现“请求输入无效”之一错误
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();
}
如果它是一个新的条目(“bug.RowKey == null”路径),那么它工作正常。如果它是对现有实体的更新,那么“AttachTo”和“UpdateObject”调用工作,但是当它到达“SaveChanges”时,它会抛出“其中一个请求输入无效”异常。
正在被存储的类是:
[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; }
}
有谁知道问题是什么?
感谢您的任何帮助。
Timestamp属性应该在服务器端填充,不确定您的客户端代码是否具有DateTime.Now功能。 – 2010-04-09 20:38:22