title: Implementing GraphQL (GraphQL for .Net) in ASP.NET Core, why is my Query:ObjectGraphType class not being registered by dependency injection?
body: <p>I've setup a basic Web Api demonstrate the use of GraphQL using ASP.Net Core. I've Followed a tutorial, what feels like exactly but am getting an error I don't understand.</p>
  
  <p>I'm using GraphQL for .NET v2.4.0</p>
  
  <p>This is the error:</p>
  
  <pre><code>System.InvalidOperationException: No service for type 'Land.GraphQL.Queries.LandQuery' has been registered.
    at at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
    at at GraphQL.FuncDependencyResolver.Resolve(Type type)
    at at GraphQL.FuncDependencyResolver.Resolve[T]()
    at Land.GraphQL.LandSchema..ctor(IDependencyResolver resolver) in .../LandSchema.cs:11
  </code></pre>
  
  <p>I'd be grateful for any light shed :)</p>
  
  <p>Here's the code:</p>
  
  <p>I created a LandType:ObjectGraphType to define the Type:</p>
  
  <pre><code>    public class LandType : ObjectGraphType&lt;Entities.Land&gt;
      {
          public LandType(ILandDataAccess landDataAccess)
          {
              Name = "Land";
  
              Field(land =&gt; land.Id, type: typeof(IdGraphType)).Description("Land Id in LandApi context");
              Field(land =&gt; land.Apn)
                  .Description(
                      "Assessor's Parcel Number (APN) is a unique number that is assigned to each tract of land in a county by the Tax Assessor.");
              Field(land =&gt; land.Address).Description("");
              Field(land =&gt; land.ZipCode).Description("");
              Field(land =&gt; land.City).Description("");
              Field(land =&gt; land.County).Description("");
              Field(land =&gt; land.State).Description("");
              Field(land =&gt; land.Country).Description("");
              Field(land =&gt; land.GisNumber).Description("");
              Field(land =&gt; land.AssessedValue).Description("");
              Field(land =&gt; land.LegalDescription).Description("");
              Field(land =&gt; land.Acreage, type: typeof(FloatGraphType)).Description("Acreage of Land");
  
          }
      }
  </code></pre>
  
  <p>I created a LandQuery:ObjectGraphType to define the Query:</p>
  
  <pre><code>public class LandQuery : ObjectGraphType
      {
          public LandQuery(ILandDataAccess dataAccess)
          {
              Field&lt;ListGraphType&lt;LandType&gt;&gt;(
                  "Land", 
                  resolve: context =&gt; dataAccess.GetLandsAsync());
          }
      }
  </code></pre>
  
  <p>I created a LandSchema:Schema to define the Schema:</p>
  
  <pre><code>public class LandSchema : Schema
      {
          public LandSchema(IDependencyResolver resolver) : base(resolver)
          {
              Query = resolver.Resolve&lt;LandQuery&gt;();
          }
      }
  </code></pre>
  
  <p>I added the service and middleware to the Startup file:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
          {
              services.AddScoped&lt;IDependencyResolver&gt;(s =&gt; new FuncDependencyResolver(
                  s.GetRequiredService));
  
              services.AddScoped&lt;LandSchema&gt;();
  
              services.AddGraphQL(o =&gt; { o.ExposeExceptions = true; })
                  .AddGraphTypes(ServiceLifetime.Scoped);
          }
  
  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {
                  app.UseGraphQL&lt;LandSchema&gt;();
          }
  </code></pre>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Thanks to the commenters @NateBarbettini and @TonyNgo inspired me to find the answer. Turns out <code>.AddGraphTypes</code> only searches the calling assembly. My GraphTypes are stored in a referenced Assembly. passing the referenced assembly fixed the problem: <code>.AddGraphTypes(typeof(LandSchema).Assembly, ServiceLifetime.Scoped);</code></p>