public override ExpressionResult VisitIdentity(EntityGraphQLParser.IdentityContext context)
        {
            var    field = context.GetText();
            string name  = schemaProvider.GetSchemaTypeNameForClrType(currentContext.Type);

            if (!schemaProvider.TypeHasField(name, field, null, claims))
            {
                throw new EntityGraphQLCompilerException($"Field {field} not found on type {name}");
            }
            var exp = schemaProvider.GetExpressionForField(currentContext, name, field, null, claims);

            return(exp);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public override string VisitIdentity(EntityGraphQLParser.IdentityContext context)
 {
     return(context.GetText());
 }
        public override ExpressionResult VisitIdentity(EntityGraphQLParser.IdentityContext context)
        {
            var field = context.GetText();

            return(MakeFieldExpression(field, null));
        }