Install and use Entity Framework power tool bate4 (code first) to automatically generate the corresponding model in the project from the existing data (newbie post, hope you can give some advice)

Source: Internet
Author: User

After learning to use MVC, I also started to get started with EF. I don't know much about the principles. I only know where to generate the model corresponding to the database after EF is installed, you do not need to write the model manually. Here we record how to generate a model in the project code from the created database. One is to record this operation method, and the other is to make it easier for cainiao like me to quickly generate a model. (I hope the heroes in the garden will give you some advice on the problem !)

Step 1: Install Entity Framework Power Tools Beta 4, open vs2013 -- tools -- Extensions and updates

Step 2: Select online on the left menu. In the search box on the top right, enter Entity Framework Power Tools Beta (4 here, I checked the latest version of 6.0 on Baidu, but I don't know what's going on)-click to download

Step 3: After the installation is complete, restart vs2013 -- Right-click the project -- select Entity Framework -- select reverse engineer code first

Step 4: As shown in the previous step, the "Connection Properties" window is displayed, and the database is installed locally. (Click). If you select the drop-down menu, you will regret it (very difficult) -- "select or enter the database name" Here select the database for which the model is to be generated -- click test connection to see if the connection is successful -- click OK

Step 5: As shown in, the model folder has generated the model corresponding to the table in your database (but the code in the mapping folder here is not very clear, only know that you can set the field attributes in the model, such as not empty, primary key, and unique)

Install and use Entity Framework power tool bate4 (code first) to automatically generate the corresponding model in the project from the existing data (newbie post, hope you can give some advice)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.