I have an interface IRepository<TEntity>, and a generic repository Repository<TEntity, TContext>. GameRepository and UserRepository are extended from Repository<TEntity, TContext>. Instead of adding the repositories manually, I want to do it in one line. I've tried the one-line solution from this answer, but it doesn't seem to work in my case.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddDbContext<ApplicationDBContext>(options =>
options.UseMySql(Configuration.GetConnectionString("DefaultConnection"))
);
services.AddScoped<GameRepository>();
services.AddScoped<UserRepository>();
}