I'm attempting to connect to my ASP.NET Core Web API application (.NET 6 in Visual Studio 2022 Preview) with SQL Server. And I tried to use the following code to configure the connection string in the Startup
class as I used to.
services.AddDbContext<DEMOWTSSPortalContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
But in .NET 6, I recognize that Startup
and Program
classes are merged into one class. And the above code is not usable in .NET 6. AddDbContext
is not recognized. So do you have any idea or documentation about this update, and how to configure connection strings in .NET 6?