This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21955|Reply: 0

[Source] EF Code Frist updates from the entity model to the database

[Copy link]
Posted on 10/19/2016 1:28:45 PM | | | |
The first time I used a model to generate a database, and it was also the first time I came into contact with Code Frist.

Step 1:

Create a new ADO.Net entity data model, select Empty Code Frist Model, and create an empty Code First model as a starting point for designing your model with code. After that, the database can be generated from your model.

He then generates a CS class file.

Step 2:

Let's create a new entity object, as follows:

Parent:




Step 3:

Modify the automatically generated CS file as follows:




Step 4:

Configure the web.config file:



Finally, run! Success!






Previous:asp.net write appSettings to the file outside
Next:Allow Entity Framework to start no longer valid __MigrationHistory table
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com