EntityFramework practice Overview, entityframework
EntityFramework is a lightweight ORM framework developed by Microsoft. It is very convenient for some small projects, with almost no configuration and support for linq, so it is very easy to use, although I have been using EntityFramework for a long time, I have not had time to summarize and learn the EntityFramework system. Now I will sort out and summarize some knowledge of EntityFramework. EntityFramework has three modes:
1. Database First (Database First ).
2. Model First (Model First ).
3. Code First is also called Code only.
So what are the differences between the three models?
Database FirstIt is based on existing databases and uses some tools (such as the EF designer provided by Vs) to create entity classes and match the database objects with Entity classes, you can also manually modify the automatically generated code and matching files.
Model FirstIn this way, we first use some tools (such as VS's EF designer) to design the object data model and the relationship between them, then generate database objects and related code files based on these entities and relationships.
Code FirstIn this way, you must first write some code, such as object and data relationship, and then automatically create data according to the existing code description. However, this method is very similar to Model First. The code we write is actually to use code to represent the entity Model, while Model First describes the entity Model visually.