Briefly talk about the advantages and disadvantages of Entity Framework

Introduction to Entity Framework

The full name of Entity Framework is ADO.NET Entity Framework, referred to as EF, is an entity framework developed by Microsoft based on ADO.NET, and was called ObjectSpace in the early days.

In addition to EF, there are many ORM frameworks under the daoNet platform: Nibernate, Dapper, PetaPoco, etc.

Advantages of EF

  • Strong cross-database support, database switching can be easily achieved by simply modifying the configuration
  • Improve development efficiency, do not need to write Sql scripts, but some special Sql scripts cannot be implemented by EF, and need to be written by ourselves (through ExecuteSqlCommadn in EF to achieve insertion, modification, deletion, and SqlQuery to execute queries)
  • The model designer provided by EF is very powerful, allowing us to clearly specify or view the relationship between tables (one-to-many, many-to-many..)
  • The navigation properties provided by EF are very useful
  • EF's lazy query loading mechanism, the data will only go to the database to query when it is used

Disadvantages of EF

  •   Poor performance (generating Sql script stage), the script generated when complex query is not very high 
  •   There will be warm-up during the first execution, and the performance will be poor during warm-up, but it will be much better after the mapping relationship is loaded into memory
  •   EF is very invasive, and once used in a project, it is difficult to remove it (after all, it is very cool to use)

I won't say much about the use of EF here. The above summary is based on my research and use, and I have summarized the information (I am still a student at present). If there is anything wrong, please point out that I will Change it now!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324978695&siteId=291194637