Home > Software design >  Startup.cs class is missing in .NET 6
Startup.cs class is missing in .NET 6

Time:02-02

I have created the Rest Api's in .Net 5 and everything was working perfectly but recently I've been moved to .NET 6 and there I've realized that no startup.cs class is present and another thing is how to add the DB Context?

CodePudding user response:

In .NET 6 Microsoft has removed the Startup.cs class. Now when you'll 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.

  •  Tags:  
  • Related