Ejemplo n.º 1
0
        internal static Key GetKey(this IGremlinQueryEnvironment environment, Expression expression)
        {
            if (expression is LambdaExpression lambdaExpression)
            {
                return(environment.GetKey(lambdaExpression.Body));
            }

            if (expression.Strip() is MemberExpression memberExpression)
            {
                return(memberExpression.TryGetWellKnownMember() == WellKnownMember.PropertyValue && memberExpression.Expression is MemberExpression sourceMemberExpression
                    ? environment.GetCache().GetKey(sourceMemberExpression.Member)
                    : environment.GetCache().GetKey(memberExpression.Member));
            }

            throw new ExpressionNotSupportedException(expression);
        }