EF preliminary understanding, EF understanding

Source: Internet
Author: User

EF preliminary understanding, EF understanding

EF stands for ADO. NET Entity Framework. It is an object-link solution developed by Microsoft Based on ADO. NET. Here, the object ing relationship is the program design model and database. EF integrates the two, so that the program designer can operate the database without understanding SQL commands.


I have a preliminary understanding of EF. I think this stuff is too powerful. I remember Jia Lin said a few days ago that a software should improve user experience. This includes not only software users, but also software developers, with EF, we have to say that the experience of developers has greatly improved.


The following example shows how to use EF to generate a database.

1. Create a project in VS. The project type is [console application] and the project name is P01FirstEF.

2. In the new project, right-click → add new item, select "ADO. NET Object Data Model" under the "data" menu, and name it.

3. After adding the object data model, you can add "entity" and "Contact. Right-click on. edmx → add → object, and name the Object User.

4. Add attributes to the object. Right-click the object and choose scalar attribute to add attributes to the object.

5. After adding multiple entities, if there is a link between the entities, you can also add foreign key constraints to the entities.

6. Of course, you can also add links between entities. In the blank area, right-click → add → join, and select ing between entities.

7. finally, the database is generated. In the blank section, right-click → generate a database based on the model. Then, the SQL statement for database table creation is automatically generated for us, we only need to create a new database in SQL Server, copy the generated SQL language, and execute it directly.


Conclusion: we feel that the technologies we are learning are moving towards improving efficiency and simplicity. In addition to the ability to generate databases based on the design model, EF can also use the data entity model to directly access the database that has been created, and add the LINQ statement, greatly reducing the workload of our development work.


Related Article

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.