Skip to content
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

Add 'arguments' to AddSingleField #168

Closed
Shane32 opened this issue Jun 17, 2019 · 7 comments
Closed

Add 'arguments' to AddSingleField #168

Shane32 opened this issue Jun 17, 2019 · 7 comments
Milestone

Comments

@Shane32
Copy link
Contributor

Shane32 commented Jun 17, 2019

Suggestion: Although QueryGraphType.AddQueryField has an arguments parameter, AddSingleField does not. I would like to suggest that this feature be added. This will be useful because I want to implement the mutation class as a QueryGraphType, utilizing AddSingleField to allow the return type to provide potentially the entire graph (including subtables) of the updated data. So it would be coded like any other mutation, except the last line would be return dbContext.MyTable.Where(x => x.Id == argumentModel.Id). This would have another benefit of not having to provide separate return graphs/models for mutations, as they can simply return the same graph/model as the query. Of course, another call to the database would be made for every update, but this could be viewed as a benefit, and would be necessary anyway if subtables were requested.

@Shane32
Copy link
Contributor Author

Shane32 commented Jun 17, 2019

If you like, I can post a pull request, but it would be later this week, as I have not delved into the source code as of yet.

@Shane32
Copy link
Contributor Author

Shane32 commented Jun 18, 2019

It appears QueryGraphType<> class just maps functions from the IEfGraphQLService<> interface. So I accessed the IEfGraphQLService<> directly in my code.

I did post a pull request, but the code didn't end up helping me because I needed to return an additional field. So I wrapped the field in another graph and accessed IEfGraphQlService<> from it directly, bypassing the QueryGraphType<> class. The end result is exactly as I was hoping!

Incidentally, adding this extra graph solved another issue with this functionality - namely, that AddSingleField is not available in an async version. Since my code performs a bunch of database work to execute the mutation, it would definitely preferred for it to be an async function.

@SimonCropp
Copy link
Owner

@Shane32
Copy link
Contributor Author

Shane32 commented Jun 19, 2019

Yes. I signed up before posting (under the company name Zbox).

@Shane32
Copy link
Contributor Author

Shane32 commented Jun 19, 2019

Ok so I find OpenCollective very confusing. I'm sure I subscribed yesterday, but I can't find it listed in my account. I even have a thank-you confirmation email, so I know it went through. And if I wanted to change the subscription amount, I'm not sure how I'd do that. Not only that, it says somewhere that I should link the account to GitHub, and I can't find anywhere to do that. I didn't see multiple tiers of subscriptions, and if you can do that I'd suggest it.

@Shane32
Copy link
Contributor Author

Shane32 commented Jun 19, 2019

Figured it out....I think.

@SimonCropp SimonCropp added this to the 6.3.0 milestone Jun 20, 2019
@SimonCropp
Copy link
Owner

dont worry about the patron thing. checked my email and u show up, but u dont show on the patrons site. i will ping opencollective and ask whats up. thanks for the effort. deploying your arg change now. should show up on nuget in ~20min.

thanks for the effort :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants