TableEntityAdapter<T>.WriteEntity(OperationContext) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Serializes the IDictionary<TKey,TValue> of property names mapped to EntityProperty data values from the OriginalEntity property.
public override System.Collections.Generic.IDictionary<string,Microsoft.Azure.Cosmos.Table.EntityProperty> WriteEntity (Microsoft.Azure.Cosmos.Table.OperationContext operationContext);
override this.WriteEntity : Microsoft.Azure.Cosmos.Table.OperationContext -> System.Collections.Generic.IDictionary<string, Microsoft.Azure.Cosmos.Table.EntityProperty>
Public Overrides Function WriteEntity (operationContext As OperationContext) As IDictionary(Of String, EntityProperty)
Parameters
- operationContext
- OperationContext
An OperationContext object that represents the context for the current operation.
Returns
An IDictionary<TKey,TValue> object that maps string property names to EntityProperty typed values created by serializing this table entity instance.
Remarks
If OriginalEntity is a simple POCO object with simple properties (primitive types, string, byte[], ...), WriteEntity(OperationContext) method will create EntityProperty objects using these properties.
Ie. A simple POCO object A with properties of B and C with this structure A->B, A->C, will be converted to key value pairs of {"B", EntityProperty(B)}, {"C", EntityProperty(C)}.
If OriginalEntity has complex properties (and potentially these properties having complex properties of their own), WriteEntity(OperationContext) method will flatten OriginalEntity first.
Ie. An object A with a simple property of B and complex properties of C and D which have their own properties of E and F with this structure A->B, A->C->E and A->D->F, will be flattened to key value pairs of:
{"B", EntityProperty(B)}, {"C_E", EntityProperty(E)} and {"D_F", EntityProperty(F)}.
For each key value pair:
1. The key is composed by appending the names of the properties visited from root (A) to end node property (E or F) delimited by "_".
2. The value is the EntityProperty object, instantiated by the value of the end node property.
All key value pairs will be stored in the returned IDictionary<TKey,TValue>.
ReadEntity(IDictionary<String,EntityProperty>, OperationContext) method recomposes the original object (POCO or complex) using the IDictionary<TKey,TValue> returned by this method and store it in OriginalEntity property.
Properties that are marked with IgnorePropertyAttribute in the OriginalEntity object will be ignored and not processed by this method.
Applies to
Azure SDK for .NET