Can't create component "" as it has dependencies to be satisfied. ASP.NET Boilerplate ( Version 9 with .NET 8)

36 Views Asked by At

I use ABP Boilerplate and .NET8, but when using ABP's DbContext class to query data from the database, I get the error as in the title. I use connection to PostgreSQL ( I changed DbContextOptionsConfigurer in ABP to UseNpgsql). Below is the code I implemented in the controller to display the list of users on the screen.

private readonly TrainingProject2DbContext dbcontext;
public HomeController(TrainingProject2DbContext dbcontext)
{
    this.dbcontext = dbcontext;
}
public ActionResult Index()
{
    Trace.WriteLine(dbcontext);
    List<User> users = dbcontext.users.ToList(); ;
    return View();
}

TrainingProject2DbContext file

public class TrainingProject2DbContext : AbpDbContext
 {
     //Add DbSet properties for your entities...
     public DbSet<User> users { get; set; }

     public TrainingProject2DbContext(DbContextOptions<TrainingProject2DbContext> options) 
         : base(options)
     {

     }

 }
0

There are 0 best solutions below