Features included in EF Core 1.0
.NET Framework 4.5.1
Includes Console, WPF, WinForms, ASP.NET 4, etc.
.NET Standard 1.3
Including ASP.NET Core targeting both .NET Framework and .NET Core on Windows, OSX, and Linux.
Based on POCO entities with get/set properties of common scalar types (
Relationships and navigation properties
One-to-many and One-to-zero-or-one relationships can be specified in the model based on a foreign key. Navigation properties of simple collection or reference types can be associated with these relationships.
These build an initial model based on the shape of the entity classes.
Allows you to override the
OnModelCreating method on your context to further configure the model that was discovered by convention.
Are attributes that can be added to your entity classes/properties and will influence the EF model (i.e. adding [Required] will let EF know that a property is required).
Relational Table mapping
Allows entities to be mapped to tables/columns.
Key value generation
Including client-side generation and database generation.
Database generated values
Allows for values to be generated by the database on insert (default values) or update (computed columns).
Sequences in SQL Server
Allows for sequence objects to be defined in the model.
Allows for the definition of alternate keys and the ability to define relationships that target that key.
Defining indexes in the model automatically introduces indexes in the database. Unique indexes are also supported.
Shadow state properties
Allows for properties to be defined in the model that are not declared and are not stored in the .NET class but can be tracked and updated by EF Core. Commonly used for foreign key properties when exposing these in the object is not desired.
Table-Per-Hierarchy inheritance pattern
Allows entities in an inheritance hierarchy to be saved to a single table using a discriminator column to identify they entity type for a given record in the database.
Detects invalid patterns in the model and provides helpful error messages.
Snapshot change tracking
Allows changes in entities to be detected automatically by comparing current state against a copy (snapshot) of the original state.
Notification change tracking
Allows your entities to notify the change tracker when property values are modified.
Accessing tracked state
Attaching detached entities/graphs
DbContext.AttachGraph API helps re-attach entities to a context in order to save new/modified entities.
Basic save functionality
Allows changes to entity instances to be persisted to the database.
Protects against overwriting changes made by another user since data was fetched from the database.
Can free up the current thread to process other requests while the database processes the commands issued from
SaveChanges is always atomic (meaning it either completely succeeds, or no changes are made to the database). There are also transaction related APIs to allow sharing transactions between context instances etc.
Relational: Batching of statements
Provides better performance by batching up multiple INSERT/UPDATE/DELETE commands into a single roundtrip to the database.
Basic LINQ support
Provides the ability to use LINQ to retrieve data from the database.
Mixed client/server evaluation
Enables queries to contain logic that cannot be evaluated in the database, and must therefore be evaluated after the data is retrieved into memory.
Queries enables quicker query execution when the context does not need to monitor for changes to the entity instances (i.e. the results are read-only).
ThenInclude methods to identify related data that should also be fetched when querying.
Can free up the current thread (and it's associated resources) to process other requests while the database processes the query.
Raw SQL queries
DbSet.FromSql method to use raw SQL queries to fetch data. These queries can also be composed on using LINQ.
Database schema management
Database creation/deletion APIs
Are mostly designed for testing where you want to quickly create/delete the database without using migrations.
Relational database migrations
Allow a relational database schema to evolve overtime as your model changes.
Reverse engineer from database
Scaffolds an EF model based on an existing relational database schema.
Connects to Microsoft SQL Server 2008 onwards.
Connects to a SQLite 3 database.
Is designed to easily enable testing without connecting to a real database.
3rd party providers
Several providers are available for other database engines. See Database Providers for a complete list.