Пример #1
0
        public KeySchema Unmarshall(JsonUnmarshallerContext context)
        {
            KeySchema keySchema = new KeySchema();

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

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

                    if (context.TestExpression("HashKeyElement", targetDepth))
                    {
                        keySchema.HashKeyElement = KeySchemaElementUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("RangeKeyElement", targetDepth))
                    {
                        keySchema.RangeKeyElement = KeySchemaElementUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(keySchema);
                }
            }


            return(keySchema);
        }
 public static KeySchemaElementUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new KeySchemaElementUnmarshaller();
     }
     return(instance);
 }