Exportar (0) Imprimir
Expandir Tudo

Método CloudTableClient.GetDataServiceContext

[Este tópico é uma documentação de pré-lançamento e está sujeito a alterações em versões futuras. Os tópicos em branco são incluídos como espaços reservados.]

Returns a TableServiceContext object for performing data operations against the Table service.

Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (em microsoft.windowsazure.storageclient.dll)

'Uso
Dim instance As CloudTableClient
Dim returnValue As TableServiceContext

returnValue = instance.GetDataServiceContext

public TableServiceContext GetDataServiceContext ()
public TableServiceContext GetDataServiceContext ()
public function GetDataServiceContext () : TableServiceContext

Valor retornado

The runtime context to use for performing data operations against the Table service.

The following code example gets an entity from a table and deletes it.


public static void DeleteEntity(CloudStorageAccount storageAccount)
{
    // Create service client for credentialed access to the Table service.
    CloudTableClient tableClient = new CloudTableClient(storageAccount.TableEndpoint.ToString(),
        storageAccount.Credentials);
    // Get the context.
    TableServiceContext context = tableClient.GetDataServiceContext();
    // Get the first entity from the table.
    ProductEntity entity = context.CreateQuery<ProductEntity>("Products").AsTableServiceQuery<ProductEntity>().FirstOrDefault();
    // Delete the entity.
    context.DeleteObject(entity);
    // Save changes to the service.
    context.SaveChanges();
}
// Define a class that represents an entity.
class ProductEntity : TableServiceEntity
{
    public ProductEntity()
    {
    }
    public string ProductName { get; set; }
    public string Category { get; set; }
    public double Price { get; set; }
    public bool InStock { get; set; }
    public DateTime DateAdded { get; set; }
    public Int32 Quantity { get; set; }
}

The Windows Azure TableServiceContext object is derived from the DataServiceContext object provided by the WCF Data Services. This object provides a runtime context for performing data operations against the Table service, including querying entities and inserting, updating, and deleting entities.


Todos os membros estáticos públicos (Compartilhados no Visual Basic) desse tipo são thread-safe. Quaisquer membros de instância não têm garantia de ser thread-safe.

Plataformas de desenvolvimento

Windows XP Professional com Service Pack 2 (SP2)

Plataformas de destino

Contribuições da comunidade

Mostrar:
© 2014 Microsoft