예제 #1
0
            public bool MoveNext()
            {
                while (_tokenizer.MoveNext())
                {
                    var tokenType = _tokenizer.Current.TokenType;

                    if (tokenType == JsonTokenType.ArrayEnd)
                    {
                        break;
                    }
                    if (tokenType != JsonTokenType.ObjectStart)
                    {
                        throw Error.Deserialization(JsonTokenType.ObjectStart, tokenType);
                    }

                    var entityData = JsonVisitor.VisitObject(_tokenizer);
                    var entityType = entityData.TryGet("_type", out var typeData)
                        ? _descriptions.GetEntityType(_converters.Read <string>(typeData))
                        : Typeof <TEntity> .Raw;

                    var entityConverter = _converters.Get(entityType);
                    var entity          = (TEntity)entityConverter.ReadObject(entityData) !;

                    Current = entity !;

                    return(true);
                }

                return(false);
            }