Esempio n. 1
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);
        }
 public static PutRequestUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new PutRequestUnmarshaller();
     }
     return(instance);
 }