private static OeSkipTokenNameValue[] ParseJson(IEdmModel model, String skipToken, IEdmStructuralProperty[] keys)
        {
            var skipTokenNameValues = new OeSkipTokenNameValue[keys.Length];

            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(skipToken)))
            {
                IODataRequestMessage requestMessage = new OeInMemoryMessage(stream, null);
                using (ODataMessageReader messageReader = new ODataMessageReader(requestMessage, ReaderSettings, model))
                {
                    var operation = new EdmAction("", "", null);
                    foreach (IEdmStructuralProperty key in keys)
                    {
                        operation.AddParameter(GetPropertyName(key), key.Type);
                    }

                    ODataParameterReader reader = messageReader.CreateODataParameterReader(operation);
                    int i = 0;
                    while (reader.Read())
                    {
                        Object value = reader.Value;
                        if (value is ODataEnumValue enumValue)
                        {
                            value = OeEdmClrHelper.GetValue(model, enumValue);
                        }
                        skipTokenNameValues[i++] = new OeSkipTokenNameValue(reader.Name, value);
                    }
                }
            }
            return(skipTokenNameValues);
        }
Exemple #2
0
        public ConstantExpression AddSkipTokenConstant(OeSkipTokenNameValue skipTokenNameValue, Type propertyType)
        {
            ConstantExpression skipTokenConstant = Expression.Constant(skipTokenNameValue.Value, propertyType);
            ConstantNode       skipTokenNode     = OeCacheComparerParameterValues.CreateSkipTokenConstantNode(skipTokenNameValue.Value, skipTokenNameValue.Name);

            AddConstant(skipTokenConstant, skipTokenNode);
            return(skipTokenConstant);
        }
Exemple #3
0
        private static OeSkipTokenNameValue[] ParseJson(IEdmModel edmModel, String skipToken, IEdmStructuralProperty[] keys, out int?restCount)
        {
            restCount = null;
            var skipTokenNameValues = new OeSkipTokenNameValue[keys.Length];

            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(skipToken)))
            {
                IODataRequestMessage requestMessage = new Infrastructure.OeInMemoryMessage(stream, null);
                using (ODataMessageReader messageReader = new ODataMessageReader(requestMessage, ReaderSettings, edmModel))
                {
                    var operation = new EdmAction("", "", null);
                    foreach (IEdmStructuralProperty key in keys)
                    {
                        operation.AddParameter(GetPropertyName(key), key.Type);
                    }
                    operation.AddParameter(RestCountName, OeEdmClrHelper.GetEdmTypeReference(edmModel, typeof(int?)));

                    ODataParameterReader reader = messageReader.CreateODataParameterReader(operation);
                    int i = 0;
                    while (reader.Read())
                    {
                        Object value = reader.Value;
                        if (value is ODataEnumValue enumValue)
                        {
                            value = OeEdmClrHelper.GetValue(edmModel, enumValue);
                        }

                        if (reader.Name == RestCountName)
                        {
                            restCount = (int)value;
                        }
                        else
                        {
                            skipTokenNameValues[i++] = new OeSkipTokenNameValue(reader.Name, value);
                        }
                    }
                }
            }
            return(skipTokenNameValues);
        }