A preliminary understanding of EF

Source: Internet
Author: User

The EF full name , the ADO Entity Framework, is a solution to the object relationship that Microsoft has developed on the basis of ADO . The object correspondence here is the program design model and database , and EF integrates the two so that the programmer can visualize the operation of the database without knowing the SQL instructions.


A preliminary understanding of EF feel this thing is too powerful, remember the previous days Marjorie Brother Siang said a software to improve user experience, not only include software users, but also software developers, with the EF has to say the experience of developers greatly improved.


Here's an example of how to build a database using EF.

1. New project in VS, Project type: [Console application], project name P01firstef

2. Then right-click → add → add new item in the new project and select "ADO" under "Data" menu. NET Entity Data model, and then name it.

3. After you have added the Entity Data model, you can add both entity and contact. Right-click on the. edmx → new → entity to name the entity user.

4. Add an attribute to an entity and right-click the entity → scalar property to add an attribute to the entity.

5. After adding multiple entities, you can also add a foreign key constraint to an entity if there is a connection between the entities.

6. Of course entities and entities can also add links between, in the blank right click → new → association, and then select the corresponding relationship between entities.               

7. Finally, the database is generated, in the blank section right-click → build the database according to the model, will automatically generate a database for us to build the SQL statement, we just need to create a new database in SQL Server, copy the generated SQL language, directly execute the next is done.

                            


Summary: We feel that the technology we are learning is moving towards greater efficiency and simpler direction. In addition to being able to generate databases from the design model, EF can also directly implement access to the database that has been created by using the data entity model, plus the LINQ statement, which greatly reduces the effort of our development effort.


A preliminary understanding of EF

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.