The Current Status of EF Core
Introduction
Last year I blogged about the then current status of EF Core, its limitations, especially when compared with other O/RMs, such as NHibernate, one of my favourites. With the recent release of EF Core 8, it’s time to revisit that post.
Primary Key Generation
In this regard, EF Core hasn’t evolved, it stayed exactly the same, which means that a proper extensible mechanism for generating primary keys is still missing.
Collection Types
EF Core 8 finally supports collections of primary types, such as List<string>, for example, which means that it doesn’t require an entity for the association. Internally, EF Core uses some clever tricks to do the persistence, including using JSON, where supported. What is still not supported is semantic collections, such as lists, sets or maps, something that has existed in NHibernate for a long time, each with their own specific behaviour.
Table Inheritance Patterns
All of the table inheritance patterns have now been implemented:
- Single Table Inheritance / Table Per Class Hierarchy
- Class Table Inheritance / Table Per Type
- Concrete Table Inheritance / Table Per Concrete Type
Expression Columns
Expression columns are now here, which means that it is possible to map random SQL to a POCO property.
Expressions for CUD Operations
Also implemented is the possibility to use stored procedures for all the CUD (Create, Update, Delete) operations, a change that will be most welcome by some DBAs.
Strongly Typed DML Operations
This is here too, it is possibly to update and delete multiple records from LINQ expressions natively from EF Core, without the need to use any extension.
Lifecycle Events
A number of lifecycle events have been implemented:
With these, plus the interceptor mechanism, it is possible to do a lot that wasn’t previously available and this definitely fixes a gap in EF Core.
Value Objects Using Complex Types
Known as components in NHibernate, these have already been implemented in EF Core 8. This means that it is possible to use types as holders of properties, but not necessarily entities. For example, whenever a set or properties repeats, we can use a complex type for this. Think of an address for example.
Conclusion
With all the recent changes to EF Core, we pretty much have all we need. Of course, things can always get better, but at the pace things have been moving, we can only imagine even brighter days are coming! Stay tuned as I will revisit EF Core 8 shortly, after I come back to my architecture series.