public KeysAndAttributes Unmarshall(JsonUnmarshallerContext context) { KeysAndAttributes keysAndAttributes = new KeysAndAttributes(); keysAndAttributes.Keys = null; keysAndAttributes.AttributesToGet = 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("Keys", targetDepth)) { keysAndAttributes.Keys = new List <Key>(); KeyUnmarshaller unmarshaller = KeyUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { keysAndAttributes.Keys.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("AttributesToGet", targetDepth)) { keysAndAttributes.AttributesToGet = new List <String>(); StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { keysAndAttributes.AttributesToGet.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(keysAndAttributes); } } return(keysAndAttributes); }
public DeleteRequest Unmarshall(JsonUnmarshallerContext context) { DeleteRequest deleteRequest = new DeleteRequest(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if ((context.IsKey) && (context.CurrentDepth == targetDepth)) { context.Read(); context.Read(); if (context.TestExpression("Key", targetDepth)) { deleteRequest.Key = KeyUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(deleteRequest); } } return(deleteRequest); }
public QueryResult Unmarshall(JsonUnmarshallerContext context) { QueryResult queryResult = new QueryResult(); queryResult.Items = 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("Items", targetDepth)) { queryResult.Items = new List <Dictionary <string, AttributeValue> >(); DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance()); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { queryResult.Items.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("Count", targetDepth)) { queryResult.Count = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("LastEvaluatedKey", targetDepth)) { queryResult.LastEvaluatedKey = KeyUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ConsumedCapacityUnits", targetDepth)) { queryResult.ConsumedCapacityUnits = DoubleUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(queryResult); } } return(queryResult); }