コード例 #1
0
        /// <summary>
        /// Flattens the entity and creates a <see cref="IDictionary{TKey,TValue}"/> of <see cref="EntityProperty"/> objects for all properties of the specified entity object.
        /// </summary>
        /// <param name="entity">The entity object to serialize.</param>
        /// <param name="entityPropertyConverterOptions">A <see cref="EntityPropertyConverterOptions"/> object that specifies options for the entity property conversion.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>An <see cref="IDictionary{TKey,TValue}"/> of <see cref="EntityProperty"/> objects for all the properties of the specified entity object.</returns>
        /// <remarks>The entity type can be a simple object with a flat structure or a complex object with complex properties and multiple levels of object hierarchy.
        /// Generic ConvertBack method can recompose the original entity using the return value of this method.</remarks>
        public static IDictionary <string, EntityProperty> Flatten(object entity, EntityPropertyConverterOptions entityPropertyConverterOptions, OperationContext operationContext)
        {
            CommonUtility.AssertNotNull("entity", entity);

            return(EntityPropertyConverter.Flatten(entity, entityPropertyConverterOptions, operationContext));
        }
コード例 #2
0
 /// <summary>
 /// Returns a custom entity instance which is recomposed using the specified <see cref="IDictionary{TKey,TValue}"/> of property names to <see cref="EntityProperty"/> data typed values.
 /// </summary>
 /// <typeparam name="TResult">The type of the recomposed object. This can be a simple object with a flat structure or a complex object with complex properties and multiple levels of object hierarchy.</typeparam>
 /// <param name="properties">An <see cref="IDictionary{TKey,TValue}"/> object that maps string property names to <see cref="EntityProperty"/> data values to deserialize and store in this table entity instance.</param>
 /// <param name="entityPropertyConverterOptions">A <see cref="EntityPropertyConverterOptions"/> object that specifies options for the entity property conversion.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 public static TResult ConvertBack <TResult>(IDictionary <string, EntityProperty> properties, EntityPropertyConverterOptions entityPropertyConverterOptions, OperationContext operationContext)
 {
     return(EntityPropertyConverter.ConvertBack <TResult>(properties, entityPropertyConverterOptions, operationContext));
 }