-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
ShopifySharp.GraphQL missing. (.NET Framework 4.8 project) #1167
Comments
Same with .net core 3.1 |
Also looking for this as my integration is .NET Framework. The short answer seems to be that all the classes in the ShopifySharp.GraphQL namespace are only included in the ShopifySharp nuget targeting .NET 6 or higher. This is controlled in the source code here: @clement911 or @nozzlegear may be able to explain why. |
On further digging the answer to why the classes in the ShopifySharp.GraphQL namespace are not available for .NET Framework is because the code makes heavy use of "default interface members", which are not supported in .NET Framework. What I am doing is copying the classes I need out of the source code (e.g. Product, ProductOption etc) plus their dependencies (GraphQLObject etc) into my own project, and adapting it to build under .NET Framework (e.g. removing default interface members from interfaces, and adding concrete implementations in the classes to satisfy the interfaces). Then these classes in theory can be used with the GraphService PostAsync method. |
Yes, you've got that correct @lanthonyneville. Unfortunately they're not available in .NET < 6 right now because of the default interfaces. I am actively looking into making them available in .NET Framework/Standard, I just don't have an ETA for it as it may tie into my source generator strategy for #1137. |
#1143 contains more info about why they don't currently work in .NET Framework right now, but you've summarized it pretty succinctly: the current implementation uses default interface methods and other .NET >= 6 features that just don't work in .NET Framework. |
Thanks @nozzlegear . For now, I have rewritten my .NET Framework code that used the ProductService and ProductVariantService to instead make direct GraphQL calls to Shopify. It's an ugly fix, but I should have it working soon. I look forward to using your new services once they're finished. |
@nozzlegear I'm getting the same issue as @trint99 in my .net 6.0 project despite the #if NET6_0_OR_GREATER directive. Is this expected behavior? |
@devtest444555 Hey! That's not expected behavior, it should work in a .NET 6 project. Are you on the latest version of ShopifySharp? And if possible, can you try upgrading to .NET 8? I believe .NET 6 is no longer supported by Microsoft, and the upgrade to .NET 8 is pretty painless if I remember correctly. |
@nozzlegear Hi! I'm currently using the latest (6.22.2), and interestingly, I just found an issue experiencing that same strange behavior: Here Thanks, I think you're right. Upgrading to .NET 8.0 would be the way to go. And sorry, I'm rather new to GraphQL, but how did you generate the GraphQLSchema.generated.cs ? Can the method you used to do that be used for other GraphQL APIs? |
My project is mired in .NET Framework 4.8 with no prospect of migrating soon.
I have ShopifySharp 6.22.2 installed.
The code samples from the wiki don't work. I can translate most of them, but the missing library has me stumped.
How do I access the new GraphQL library?
The text was updated successfully, but these errors were encountered: