/// <summary>
        /// Construct a complex type value according to its metadata definition.
        /// </summary>
        /// <param name="complexName">The name of the complex type.</param>
        /// <returns>The JSON object value of the complex type.</returns>
        public JObject ConstructAComplexTypeValue(string complexName)
        {
            string        metadataDoc              = ServiceStatus.GetInstance().MetadataDocument;
            JObject       result                   = new JObject();
            List <string> complextTypeNames        = MetadataHelper.GetAllComplexNameFromMetadata(metadataDoc);
            Dictionary <string, string> properties = MetadataHelper.GetAllPropertiesOfComplexType(metadataDoc, complexName);

            foreach (string prop in properties.Keys)
            {
                string type = properties[prop];
                if (EdmTypeManager.IsEdmSimpleType(type))
                {
                    IEdmType edmType = EdmTypeManager.GetEdmType(type);
                    result[prop] = edmType.GetJsonValueTemplate();
                }
                else if (type.Contains("Collection"))
                {
                    string itemType = type.Substring(type.IndexOf('(') + 1, type.Length - 12).GetLastSegment();

                    result[prop] = ConstructCollectionTypeValue(itemType);
                }
                else if (MetadataHelper.IsEnumType(metadataDoc, type))
                {
                    result[prop] = ConstructEnumTypeValue(type);
                }
                else if (complextTypeNames != null && complextTypeNames.Contains(type))
                {
                    result[prop] = ConstructAComplexTypeValue(type);
                }
            }

            return(result);
        }
        /// <summary>
        /// Provide value template for a primitive type.
        /// </summary>
        /// <param name="type">The primitive type name.</param>
        /// <returns>The template value of the primitive type.</returns>
        public string ConstructPrimitiveTypeValue(string type)
        {
            if (EdmTypeManager.IsEdmSimpleType(type))
            {
                IEdmType edmType = EdmTypeManager.GetEdmType(type);
                return(edmType.GetJsonValueTemplate());
            }

            return(null);
        }