Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Startup.cs class is missing in .NET 6

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?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading