Including ASP.NET Core targeting both .NET Framework and .NET Core on Windows, OSX, and Linux.
Modelling
Basic modelling
Based on POCO entities with get/set properties of common scalar types (int, string, etc.).
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.
Built-in conventions
These build an initial model based on the shape of the entity classes.
Fluent API
Allows you to override the OnModelCreating method on your context to further configure the model that was discovered by convention.
Data annotations
Are attributes that can be added to your entity classes/properties and will influence the EF model. For example, 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.
Unique constraints
Allows for the definition of alternate keys and the ability to define relationships that target that key.
Indexes
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.
Model validation
Detects invalid patterns in the model and provides helpful error messages.
Change tracking
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
Via DbContext.Entry and DbContext.ChangeTracker.
Attaching detached entities/graphs
The new DbContext.AttachGraph API helps re-attach entities to a context in order to save new/modified entities.
Saving data
Basic save functionality
Allows changes to entity instances to be persisted to the database.
Optimistic Concurrency
Protects against overwriting changes made by another user since data was fetched from the database.
Async SaveChanges
Can free up the current thread to process other requests while the database processes the commands issued from SaveChanges.
Database Transactions
Means that 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.
Query
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.
NoTracking
Queries enables quicker query execution when the context does not need to monitor for changes to the entity instances (this is useful if the results are read-only).
Eager loading
Provides the Include and ThenInclude methods to identify related data that should also be fetched when querying.
Async query
Can free up the current thread (and it's associated resources) to process other requests while the database processes the query.
Raw SQL queries
Provides the 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.
Database providers
SQL Server
Connects to Microsoft SQL Server 2008 onwards.
SQLite
Connects to a SQLite 3 database.
In-Memory
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.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: