-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not Recognized Args by creating at runtime args Type #75
Comments
Hi @Djangoum, Could you also post some of the schema setup code where you're using these generated types with GraphQL.Net? I won't know for sure until I see what you've got, but I suspect that you'll need to use reflection to call the setup methods on the schema. Currently the schema setup methods use generics to get compile-time type information, but your types only exist at runtime. |
This is the file where i have all the code written. The process begans at "RegisterDbContext" method. Thanks for your quick response. Greetings!
|
So there are a few issues you'll encounter with getting this to work. The first is the one that you're immediately encountering with passing a compile-time Take a look at: https://msdn.microsoft.com/en-us/library/system.reflection.methodinfo.makegenericmethod(v=vs.110).aspx To call a generic method by reflection, you have to do something like this (approximation - not exact):
The other issue you might run into is that I don't think that GraphQL.Net and System.Linq.Dynamic will combine very well. I haven't tested it myself, but GraphQL.Net works by gluing expressions together and I'm not sure that dynamically generated expressions will work. However, it's possible that they will so I'd start by trying to fix the above piece about generics first and then seeing how the rest of it works. |
Hi @ckimes89, with the help of my friend @magicheron , we have done what you suggested, we call the method "AddListField" by reflection. This is solved and the code will be uploaded soon to a github repo. I can post you here if you want when it's uploaded. Thanks for your support! |
@Djangoum Good to hear! I'd be interested to see the result when it's up on github. |
Hi, I'm trying to write an automated entityFramework implementation schema builder on GraphQL.Net.
And I'm generating the Args Type dynamically with System.Reflection.Emit namespace methods.
Everything seems to be Ok when i'm generating my GraphQl.Net Schema but when i try to query the Args are not recognized by the parser.
This is the functions i'm using to create the Args Type at run time.
I'm doing this because i need to make not nullable properties nullable properties so i can ommit then on query building. Query building is handled by Dynamic Linq.
I think the problem is to passing an object as TArgs, but i dont realize how to solve it.
Sorry for my many english mistakes and thank you!
Also i want to congrat you about this project is amazing!
Greetings.
The text was updated successfully, but these errors were encountered: