Create entity data model From Databse in asp.net MVC
In this post, I am explain how to Entity data model from database in asp.net Mvc4 application.Step :- 1 New project
Go to File > New > Project > Select asp.net MVC4 web application > Entry Application Name > Click OK > Select Internet Application > Select view engine Razor > click OK
Below Show image
After that new project Create Now, go to the step-2
Step :- 2 Create New Database
Go to the start menu > click to sql server management > click to connect > now right click to database > select new database > now open popup box > Enter database name and store location for your drive > click on button > Now create database look like this
Step :- 3 Now Create new database table.
click to database name > Right click to table > click to new table > Now enter database table fields > after that save table.
For example
Set primary key for imageId with use for uniqueidentifire datatype then select Rowguid yes.
Otherwise if you can use Imageid datatype for int then select Identity Specification Yes.
Step :- 4 Now go to the visual studio and Create Entity data model
Go to Solution Explorer > Right Click on Project name > Add > New item >Select Data > Select ADO.net Entity Data Model > Enter model name > Click Add Button.
Below Show Image.
Now,
A popup window will Open (Entity Data Model Wizard) > Select Generate from database > Next >
Chose your data connection > select your database > next >Select Entity framework > next
Below Show image
Select tables > enter Model Namespace > Finish.
Finally Entity data model was Created
No comments
Post a Comment