public WriteRequest Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            WriteRequest writeRequest = new WriteRequest();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("PutRequest", targetDepth))
                {
                    writeRequest.PutRequest = PutRequestUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("DeleteRequest", targetDepth))
                {
                    writeRequest.DeleteRequest = DeleteRequestUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(writeRequest);
        }
Example #2
0
        public WriteRequest Unmarshall(JsonUnmarshallerContext context)
        {
            WriteRequest writeRequest = new WriteRequest();

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

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

                    if (context.TestExpression("PutRequest", targetDepth))
                    {
                        writeRequest.PutRequest = PutRequestUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("DeleteRequest", targetDepth))
                    {
                        writeRequest.DeleteRequest = DeleteRequestUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(writeRequest);
                }
            }


            return(writeRequest);
        }
Example #3
0
 public static DeleteRequestUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new DeleteRequestUnmarshaller();
     }
     return(instance);
 }