Amazon.DynamoDBv2.Model.Internal.MarshallTransformations.AttributeDefinitionUnmarshaller.Unmarshall C# (CSharp) Метод

Unmarshall() публичный Метод

Unmarshaller the response from the service to the response class.
public Unmarshall ( JsonUnmarshallerContext context ) : AttributeDefinition
context JsonUnmarshallerContext
Результат AttributeDefinition
        public AttributeDefinition Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null) 
                return null;

            AttributeDefinition unmarshalledObject = new AttributeDefinition();
        
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("AttributeName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.AttributeName = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("AttributeType", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.AttributeType = unmarshaller.Unmarshall(context);
                    continue;
                }
            }
          
            return unmarshalledObject;
        }

Usage Example

        public TableDescription Unmarshall(JsonUnmarshallerContext context)
        {
            TableDescription tableDescription = new TableDescription();

            tableDescription.AttributeDefinitions  = null;
            tableDescription.KeySchema             = null;
            tableDescription.LocalSecondaryIndexes = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("AttributeDefinitions", targetDepth))
                    {
                        tableDescription.AttributeDefinitions = new List <AttributeDefinition>();
                        AttributeDefinitionUnmarshaller unmarshaller = AttributeDefinitionUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                tableDescription.AttributeDefinitions.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("TableName", targetDepth))
                    {
                        tableDescription.TableName = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("KeySchema", targetDepth))
                    {
                        tableDescription.KeySchema = new List <KeySchemaElement>();
                        KeySchemaElementUnmarshaller unmarshaller = KeySchemaElementUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                tableDescription.KeySchema.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("TableStatus", targetDepth))
                    {
                        tableDescription.TableStatus = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CreationDateTime", targetDepth))
                    {
                        tableDescription.CreationDateTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ProvisionedThroughput", targetDepth))
                    {
                        tableDescription.ProvisionedThroughput = ProvisionedThroughputDescriptionUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("TableSizeBytes", targetDepth))
                    {
                        tableDescription.TableSizeBytes = LongUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ItemCount", targetDepth))
                    {
                        tableDescription.ItemCount = LongUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("LocalSecondaryIndexes", targetDepth))
                    {
                        tableDescription.LocalSecondaryIndexes = new List <LocalSecondaryIndexDescription>();
                        LocalSecondaryIndexDescriptionUnmarshaller unmarshaller = LocalSecondaryIndexDescriptionUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                tableDescription.LocalSecondaryIndexes.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(tableDescription);
                }
            }


            return(tableDescription);
        }
All Usage Examples Of Amazon.DynamoDBv2.Model.Internal.MarshallTransformations.AttributeDefinitionUnmarshaller::Unmarshall
AttributeDefinitionUnmarshaller