private static KeyValuePair <String, Object>[] GetNavigationSkipTokenKeys(OeEntryFactory entryFactory, OrderByClause orderByClause, Object value) { IEdmStructuralProperty[] keyProperties = OeSkipTokenParser.GetEdmProperies(orderByClause); var keys = new KeyValuePair <String, Object> [keyProperties.Length]; for (int i = 0; i < keys.Length; i++) { String propertyName = OeSkipTokenParser.GetPropertyName(keyProperties[i]); OePropertyAccessor accessor = entryFactory.GetAccessorByName(keyProperties[i].Name); keys[i] = new KeyValuePair <String, Object>(propertyName, accessor.GetValue(value)); } return(keys); }
private IEnumerable <KeyValuePair <String, Object> > GetKeys(T entity) { var visitor = new OeQueryNodeVisitor(_edmModel, Expression.Parameter(typeof(T))); OrderByClause orderByClause = _odataUri.OrderBy; do { var propertyExpression = (MemberExpression)visitor.TranslateNode(orderByClause.Expression); UnaryExpression body = Expression.Convert(propertyExpression, typeof(Object)); Expression <Func <T, Object> > getValueLambda = Expression.Lambda <Func <T, Object> >(body, visitor.Parameter); Object value = getValueLambda.Compile()(entity); yield return(new KeyValuePair <String, Object>(OeSkipTokenParser.GetPropertyName(propertyExpression), value)); orderByClause = orderByClause.ThenBy; }while (orderByClause != null); }