Экспорт (0) Печать
Развернуть все

Метод CloudTableClient.GetDataServiceContext

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

Пространство имен: Microsoft.WindowsAzure.StorageClient
Сборка: Microsoft.WindowsAzure.StorageClient (в microsoft.windowsazure.storageclient.dll)

'Применение
Dim instance As CloudTableClient
Dim returnValue As TableServiceContext

returnValue = instance.GetDataServiceContext

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

Возвращаемое значение

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.


Все открытые статические (Совместно используемая в Visual Basic) члены этого типа являются потокобезопасными. Потокобезопасность членов экземпляров не гарантируется.

Платформы разработки

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

Целевые платформы

Добавления сообщества

Показ:
© 2014 Microsoft