What happens if you try to create an object twice:
CloudTableClient client = new CloudTableClient(
new StorageCredentialsAccountAndKey("thing", "****blurb******"));
client.CreateTableIfNotExist("TestData");
var context1 = client.GetDataServiceContext();
Thing t = new Thing();
t.PartitionKey = "Fred";
t.RowKey = "Bloggs";
t.TestField = "test";
context1.AddObject("TestData", t);
var response = context1.SaveChanges();
context1.Detach(t);
context1.AddObject("TestData", t);
response = context1.SaveChanges();
the answer... is that you get an exception thrown in the second "SaveChanges()" - the exception is System.Data.Services.Client.DataServiceRequestException - with an InnerException of type DataServiceClientException -with StatusCode 409 - EntityAlreadyExists
This error code is listed - http://msdn.microsoft.com/en-us/library/dd179438.aspx
No comments:
Post a Comment