Hello Friends, Today in this Video We Teach You "How to Setup Database Connection in NET 6 Project | Complete Tutorial".
Friends, Database if Very Important Part of Every Project. You Need to Watch this Video Very Closely for Better Understanding of Database Connection. We are using Code First Approach in this Project for Model Based Database Tables, It's Easy to Manage and Very Good for Small Projects.
We Need to Follow 3 Steps for Add Database into Our Project, Here's the Steps
1. Create DbContext File: First of All we create a New cs file into Our Data Layer Project. We Create a File ApplicationDbContext.cs then Inherit this File with DbContext Class and then Create Constructor and Add base option.
Then Add DbSet with Table Name in this file.
For DbContext file we need to Add Nuget 'Microsoft.EntityFrameworkCore'.
2. Add Connection String: Second is We need to Add Connection String into appsettings.json File.
3. Setup Startup File: Final is We Need to Add Database Default ConnectionString into Our Startup file with Add ApplicationDbContext.cs File so we Can always use ApplicationDbContext into Our Project as a Database File. (This is Very Important Step)
Download Project from Github
https://github.com/Buntysoni/YouTubeT...
For Any Type of Help, You Can Contact me. We are Always Ready for Help You.
Follow OR Contact us
Personal - / bunty_soni_
Facebook - / gurujigyan