Skip to content

How to merge two repositories to one query? #5291

Answered by sturlath
sturlath asked this question in Q&A
Discussion options

You must be logged in to vote

I got help on Slack for getting the queries into one (all methods are now shown) but now I need to figure out how to show them separately under their device types.

  _ = services
          .AddScoped<IDeviceOneRepository , DeviceOneRepository >()
          .AddScoped<IDeviceTwoRepository , DeviceTwoRepository >()
          .AddGraphQLServer()
          .AddApolloFederation()
          .AddQueryType(d => d.Name("Query"))
                .AddTypeExtension<DeviceOneQuery >()
                .AddTypeExtension<DeviceTwoQuery>()

and then on both queries I added [ExtendObjectType("Query")]

with end result like this

[ExtendObjectType("Query")]
public class DeviceOneQuery 
{
    private readonly I…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@sturlath
Comment options

@sturlath
Comment options

@tobias-tengler
Comment options

@sturlath
Comment options

@tobias-tengler
Comment options

Answer selected by sturlath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants