Dineshi
Dineshi

Reputation: 1

Generate from database

I am new to MVC application. When I tried to create the Model I wanted to find "Generate from database" option as follow.

enter image description here

But I have following options.

enter image description here

Which option I can select instead "Generate from database" option.

Upvotes: 0

Views: 63

Answers (2)

SaadK
SaadK

Reputation: 1557

  1. Right-click the Models folder, and select Add and New Item.
  2. In the Add New Item window, select Data in the left pane and ADO.NET Entity Data Model from the options in the center pane. Name the new model file.
  3. Click Add.
  4. In the Entity Data Model Wizard, select EF Designer from database.
  5. Click Next.
  6. If you have database connections defined within your development environment, you may see one of these connections pre-selected. However, if you want to create a new connection. Click the New Connection button.
  7. In the Connection Properties window, provide the name of the local server where your database was created or you sql server name. After providing the server name, select your database from the available databases.
  8. Click OK.
  9. The correct connection properties are now displayed. You can use the default name for connection in the Web.Config file
  10. Click Next.
  11. Select Tables to generate models for the needed tables.

Click Finish.

For the full tutorial on Microsoft website https://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application

Upvotes: 1

Motimash
Motimash

Reputation: 63

If you want to create entity classes, then choose the "EF Designer from database", then follow below:

  1. New connection.
  2. Change.
  3. Microsoft sql server.
  4. insert your SQL server name + SQL credential
  5. Chose your database.
  6. Test connection, if you got it right press k.
  7. Next > Next.
  8. Then choose the table you would like to generate.

Upvotes: 0

Related Questions