PART 3: Generating Database From Entity Model Designed in EDMX

Till now, you have designed your entity model in EDMX Designer. It’s time to generate database and tables from your model.

Note: We divided this project into 4 Parts and this is the 3rd PART

Parts of this Project
1. Right Click on blank area of Designer Page Generate Database from Model
GenerateDatabaseModel

2. A Connection wizard will appear. This wizard guides you to make a successful connection to the server. Click on New Connection button.

 

3. Give server name as .\SQLEXPRESS and Enter Database name as CustomerDB. Click OK Button.

ConnectionProperties

4. A confirmation box will ask you to create a new database. Click on Yes button.

ConnectionProperties

5. Database CustomerDB is created and you can see the connection string in next wizard. Click Next.

GenerateDatabaseWizard

6. In the next wizard, a script is ready. Click on Finish button.

GenerateDatabaseWizard

7. You will see that a new page adds in your project with SQL script. Right Click on it Execute.

ExecuteScript

8. In the next window, provide server name as .\SQLEXPRESS and then select CustomerDB database. Click connect.

Connect

You will get command (s) completed successfully. Congratulations. You have created entity model and generated database and tables. Now, it’s time to generate controller and view page for your project.

Build your Project by pressing Ctrl + Shift + B.

Summary

In this chapter, you learned how to generate the database from Entity Model which is designed in EDMX Designer. In the next Part, we will add Scaffolded Item and Run the Project.

 

Share your thought