Alternative to registering all GraphType
hnviradiya opened this issue · comments
Is there any better alternative than registering all graphql types in following way? As with growing GraphType it will be a long list. Sorry that I had to post here. As stackoverflow doesn't allow external link.
container.Singleton(new StarWarsData());
container.Register();
container.Register();
container.Register();
container.Register();
container.Register();
container.Register();
container.Singleton(new StarWarsSchema(new FuncDependencyResolver(type => container.Get(type))));
Yes, though it would depend on your container and how you’ve defined your graph types. You can loop through all types in an assembly and add ones that inherit from GraphType to your container, as one approach. Some containers make that easier than others. Consult the docs for the container you’re using.