Replies: 1 comment 2 replies
-
There is no constructor for a But you could of course load the content of your .graphql files into memory (as strings) and then use them in the requests, selecting the correct query using the operation name. I'd recommend adding your .graphql file as embedded resource and loading its content once on application startup, here is a short example on how to load a string from a embedded resource: var assembly = typeof(ATypeInYourApplication).Assembly;
using var stream = assembly.GetManifestResourceStream($"your.path.to.queries.graphql")
?? throw new MissingManifestResourceException($"resource \"queries.graphql\" not found");
using var reader = new StreamReader(stream);
string queries = reader.ReadToEnd(); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible inside the client to use .graphql files to use queries from them? Putting whole query inside a code makes it a bit unreadable, making query one line makes query unreadable. I'm pretty beginner dev so I just want a simple way to have queries separately and readable and at the same time keeping everything efficient. If I misunderstood the whole thing about .graphql files please correct me
Beta Was this translation helpful? Give feedback.
All reactions