title: How can I solve the error in my API project?
body: <p>I added an API project to my project. Although I have given all references when I run it, I get the following error. How can I fix?
  <a href="https://i.stack.imgur.com/BF05M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BF05M.png" alt="enter image description here" /></a></p>
  <hr />
  <p>This is my startup file:</p>
  <p>public class Startup
  {
  public Startup(IConfiguration configuration)
  {
  Configuration = configuration;
  }</p>
  <pre><code>    public IConfiguration Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddScoped(typeof(ShopContext));
          services.AddDbContext&lt;ShopContext&gt;(options =&gt; options.UseSqlServer(Configuration[&quot;ConnectionStrings:SqlConStr&quot;].ToString(),
              o =&gt;
              {
                  o.MigrationsAssembly(&quot;BuyfiletData&quot;);
              }));
          services.AddScoped(typeof(IRepository&lt;&gt;), typeof(EfCoreGenericRepository&lt;&gt;));
          services.AddScoped&lt;IProductRepository, EfCoreProductRepository&gt;();
          services.AddScoped&lt;IProductService, ProductManager&gt;();
  
  
  
          services.AddControllers();
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
          
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
          app.UseHttpsRedirection();
  
          app.UseRouting();
  
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapControllers();
          });
      }
  }
  </code></pre>
  <hr />
  <p>Although I have added all references in my project, I am encountering this error. Despite a lot of research, I could not figure it out. Please help me.
  If I have other project files I need to add, I can.</p>
  <hr />
  <p>This is my EfCoreProductRepository file:</p>
  <pre><code> public class EfCoreProductRepository : EfCoreGenericRepository&lt;Product&gt;, IProductRepository
      {
          
          private ShopContext _context { get=&gt;_context as ShopContext;}
  
          public EfCoreProductRepository(DbContext context) : base(context)
          {
          }
          public List&lt;Product&gt; GetProductsWithCategory(string name, int page, int pageSize)
          {
              
              
                  var products = _context.Products.AsQueryable();
                  if (!string.IsNullOrEmpty(name))
                  {
                      
                          products = products.Include(i =&gt; i.ProductCategories)
                      .ThenInclude(i =&gt; i.BasicCategory)
                      .Where(i =&gt; i.ProductCategories.Any(a =&gt;
                      a.BasicCategory.Name.ToLower() == name.ToLower() || a.MainCategory.Name.ToLower()==name.ToLower() ||a.SubCategory.Name.ToLower()== name.ToLower()));
                      
                  }
                  return products.Skip((page - 1) * pageSize).Take(pageSize).ToList();
              
          }
  
          public List&lt;Product&gt; GetProductsWithFilters(List&lt;Product&gt; productList, int page, int pageSize, int maxPrice, int minPrice)
          {
              
                  var products = _context.Products.AsQueryable();
                  /*products= products.Where(i =&gt; i.Brand == product.Brand &amp;&amp; i.Point == product.Point&amp;&amp; i.Variety == product.Variety&amp;&amp; i.Size == product.Size&amp;&amp; i.Color == product.Color&amp;&amp; i.Gender == product.Gender);*/
                  foreach (var product in productList)
                  {
                      products = products.Where(i =&gt;
                          i.Brand == product.Brand &amp;&amp; i.Point == product.Point &amp;&amp; i.Variety == product.Variety &amp;&amp;
                          i.Size == product.Size &amp;&amp; i.Color == product.Color &amp;&amp; i.Gender == product.Gender);
                  }
  
                  products.Where(i =&gt; i.Price &gt; minPrice &amp;&amp; i.Price &lt; maxPrice);
                  return products.Skip((page - 1) * pageSize).Take(pageSize).ToList();
              
          }
  
      
  
          public List&lt;Product&gt; GetProductsWithSearch(string word,int page, int pageSize)
          {
            
                  var products = _context.Products.Where(i=&gt;i.Brand.Contains(word.ToLower())|| i.MainCategory.Contains(word.ToLower())|| i.Category.Contains(word.ToLower()) || i.Details.Contains(word.ToLower())).AsQueryable();
                  return products.Skip((page - 1) * pageSize).Take(pageSize).ToList();
              
          }
  
  
         
      }
  </code></pre>