In a recent article we have discussed about upgrading legacy applications using .NET Core we mentioned a few different technologies for which, as explained, it would have been difficult to get into details for each of them. This new article will provide more information about Entity Framework Core and why we have decided to use it at Synetec.
Entity Framework Core is not more than a lightweight version of the popular Entity Framework. For readers who don’t know anything about that it is an object-relational mapper (ORM) which means that developers don’t need to write most of the data access code needed to communicate with the database. One of the big benefit of that is that you could have engineers with very little or no experience writing SQL. There are debate within the community talking about the benefits of using an ORM or simply to stick with SQL code and stored procedures. We mentioned in the previous article that there is no perfect solution and the technical decisions you make can be driven by what you want to achieve with your applications.
Let’s see some advantages of using Entity Framework Core and ORMs in general:
- Productivity: as the developers don’t need to worry about writing the data access code they have more time to focus on the feature development itself
- Application design: an ORM is a tool designed by experienced engineers and architects which means that to fully take advantages of it you need to adopt good programming practices in your applications
- Code reuse: writing a class library to access your entities is a good approach and you would need to write it only once and reference the library in the applications when you need it
- Maintainability: if integrated properly with a good architecture when you need to change your database schema you wouldn’t need to rewrite the business logic and how your entities are used across the applications.
Of course advantages means that there are some disadvantages:
- Understanding: developer who are not very curious by nature won’t understand what the code is actually doing behind the scene
- Control: you have less control than when you write plain SQL
- Performance: as the SQL is generated by the tool it makes it more complicated to control the performances of the data access and for complex queries an ORM will fail to compete with SQL, particularly as sql stored procedures are pre-compiled and ORM queries are not.
As with .NET Core, Entity Framework Core is a brand new tool, not just a simple upgrade of Entity Framework 6. The great benefit being that the tool can start its journey based on good foundations and a disadvantage being of course that it is not as mature as its predecessor.
If you want to know the details of how to integrate the tool a search on Google will give you more information than you need on the first page. The focus for this series of articles is to analyze the technologies we are currently adopting at Synetec and also to explain the decisions we made. So don’t hesitate to subscribe to receive more news about exciting technologies.
Written by Tarik Miri