Exportar (0) Imprimir
Expandir todo

TableServiceContext.SaveChangesWithRetries (Método) ()

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

Espacio de nombres: Microsoft.WindowsAzure.StorageClient
Ensamblado: Microsoft.WindowsAzure.StorageClient (en microsoft.windowsazure.storageclient.dll)

'Uso
Dim instance As TableServiceContext
Dim returnValue As DataServiceResponse

returnValue = instance.SaveChangesWithRetries

public DataServiceResponse SaveChangesWithRetries ()
public DataServiceResponse SaveChangesWithRetries ()
public function SaveChangesWithRetries () : DataServiceResponse

Valor devuelto

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.


Cualquier miembro estático público (Shared en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Plataformas de desarrollo

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 y Windows 2000

Plataformas de destino

Adiciones de comunidad

Mostrar:
© 2014 Microsoft