Table of Contents

Interface ITableEntity

Namespace
Microsoft.WindowsAzure.Storage.Table
Assembly
Microsoft.WindowsAzure.Storage.dll

An interface required for table entity types. The ITableEntity interface declares getter and setter methods for the mandatory entity properties, and ReadEntity(IDictionary<string, EntityProperty>, OperationContext) and WriteEntity(OperationContext) methods for serialization and de-serialization of all entity properties using a property dictionary. Create classes implementing ITableEntity to customize property storage, retrieval, serialization and de-serialization, and to provide additional custom logic for a table entity.

public interface ITableEntity

Remarks

The storage client library includes two implementations of ITableEntity that provide for simple property access and serialization:

DynamicTableEntity implements ITableEntity and provides a simple property dictionary to store and retrieve properties. Use a DynamicTableEntity for simple access to entity properties when only a subset of properties are returned (for example, by a select clause in a query), or for scenarios where your query can return multiple entity types with different properties. You can also use this type to perform bulk table updates of heterogeneous entities without losing property information.

TableEntity is an implementation of ITableEntity that uses reflection-based serialization and de-serialization behavior in its ReadEntity(IDictionary<string, EntityProperty>, OperationContext) and WriteEntity(OperationContext) methods. TableEntity-derived classes with methods that follow a convention for types and naming are serialized and deserialized automatically. TableEntity-derived classes must also provide a get-able and set-able public property of a type that is supported by the Microsoft Azure Table service.

Properties

ETag

Gets or sets the entity's current ETag. Set this value to '*' in order to blindly overwrite an entity as part of an update operation.

string ETag { get; set; }

Property Value

string

The entity's timestamp.

PartitionKey

Gets or sets the entity's partition key.

string PartitionKey { get; set; }

Property Value

string

The entity's partition key.

RowKey

Gets or sets the entity's row key.

string RowKey { get; set; }

Property Value

string

The entity's row key.

Timestamp

Gets or sets the entity's timestamp.

DateTimeOffset Timestamp { get; set; }

Property Value

DateTimeOffset

The entity's timestamp. The property is populated by the Microsoft Azure Table Service.

Methods

ReadEntity(IDictionary<string, EntityProperty>, OperationContext)

Populates the entity's properties from the EntityProperty data values in the properties dictionary.

void ReadEntity(IDictionary<string, EntityProperty> properties, OperationContext operationContext)

Parameters

properties IDictionary<string, EntityProperty>

The dictionary of string property names to EntityProperty data values to deserialize and store in this table entity instance.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

WriteEntity(OperationContext)

Serializes the IDictionary<TKey, TValue> of property names mapped to EntityProperty data values from the entity instance.

IDictionary<string, EntityProperty> WriteEntity(OperationContext operationContext)

Parameters

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

IDictionary<string, EntityProperty>

An IDictionary<TKey, TValue> object of property names to EntityProperty data typed values created by serializing this table entity instance.