Here, we will learn about using DB First approach in ASP.NET MVC with entity framework. In DB first approach, Database is created first and from the database, POCO classes are generated automatically by Entity framework.
Firstly we will create the database in SQL Server.
Create the database
Enter the database name
Create the table.
Enter the table fields and make Id column as Identity
Enter the table name
Open Visual Studio and create a new project.
Enter the project name and select ASP.NET Web Application
Choose MVC as a framework
Now we have to Install the Entity Framework for performing database related operations. So open the Package manager console.
Write the command in the console
Install-Package EntityFramework
Add the ADO.NET Entity Data Model into the Models folder.
Choose Data from Left Menu and choose ADO.NET Entity Data Model and give it a name.
Choose EF Designer From Database and Click next.
Select the Server and authentication types and database
Test the connection as it properly has done or not.
Enter the Model name if you have to change.
Choose the object you want to include in EDMX file.
You will see the .edmx file
Now your connection will be registered with your web application and you can see the connection string in Web.Config file present at the root folder.
You will see that the Model is generated in the Models folder.
Further, we will continue in Part-2
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
View Comments
Good post but I was wanting to know if you could write a litte more on this subject? I'd be very thankful if you could elaborate a little bit more. Thanks!
Sure, I'll, can you write what you expecting more on this subject?
I do not even know how I ended up here, but I thought this post was good. I do not know who you are but certainly you're going to a famous blogger if you are not already ;) Cheers!
Thanks for the feedback!