Пример #1
0
        public override ExpressionResult VisitIdentity(EntityGraphQLParser.IdentityContext context)
        {
            // this should be an enum
            var enumVal   = context.GetText();
            var enumField = schema.EnumTypes()
                            .Select(e => e.GetFields().FirstOrDefault(f => f.Name == enumVal))
                            .Where(f => f != null)
                            .FirstOrDefault();

            var exp = (ExpressionResult)Expression.Constant(Enum.Parse(enumField.ReturnType.TypeDotnet, enumField.Name));

            return(exp);
        }