Dışarıya aktar (0) Yazdır
Tümünü Genişlet
EN
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

TableServiceContext.SaveChangesWithRetries Method ()

Updated: April 24, 2013

[This topic is part of the Windows Azure Storage Client Library 1.7, which has been deprecated. The current recommended version is Storage Client Library 3.0.]

Saves changes to the Table service, using the retry policy specified for the TableServiceContext object.

Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)

'Kullanım

public DataServiceResponse SaveChangesWithRetries ()

Return Value

Type: System.Data.Services.Client.DataServiceResponse

A DataServiceResponse that represents the result of the operation.

The following code example inserts an entity into a table.

public static void InsertContact(CloudTableClient tableClient, string firstName, string lastName, string email,
    string cellPhone, string homePhone, string streetAddress, string city, string state, string zipCode)
{
    // Get data context.
    TableServiceContext context = tableClient.GetDataServiceContext();

    // Create the new entity.
    ContactEntity entity = new ContactEntity();

    // Partition key is first letter of contact's first name.
    entity.PartitionKey = firstName.Substring(0, 1).ToUpper();

    // Row key is value of first name, with GUID appended to avoid conflicts in case where two first names are the same.
    entity.RowKey = firstName + "_" + Guid.NewGuid().ToString();

    // Populate the other properties.
    entity.FirstName = firstName;
    entity.LastName = lastName;
    entity.Email = email;
    entity.CellPhone = cellPhone;
    entity.HomePhone = homePhone;
    entity.StreetAddress = streetAddress;
    entity.City = city;
    entity.State = state;
    entity.ZipCode = zipCode;

    // Add the entity.
    context.AddObject(tableName, entity);

    // Save changes to the service.
    context.SaveChangesWithRetries();
}

public class ContactEntity : TableServiceEntity
{
    public ContactEntity()
    {
    }

    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Email { get; set; }
    public string HomePhone { get; set; }
    public string CellPhone { get; set; }
    public string StreetAddress { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string ZipCode { get; set; }
}

The SaveChangesWithRetries method behaves in the same manner as the SaveChanges method, with the addition of retries as specified by the RetryPolicy property.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7 and Windows Server 2008

Target Platforms

Show:
© 2014 Microsoft