In .NET 6 Microsoft has removed the Startup.cs class. Just go to the program.cs file and there you can add a connection string then you’ve to use builder.Services.AddDbContext
The old way is
services.AddDbContext
Just use
builder.Services
and then you can achieve what you want.