|
Answer» Below are some of Entity Framework's basic features: - Cross-Platform: It is lightweight, extensible, open-source, and can be used on Windows, Linux, and Mac.
- Querying: It allows us to retrieve data from underlying databases using LINQ queries, which are then TRANSFORMED into database-specific query languages.
- Modeling: EDMS (Entity Data Models) are typically created based on POCOs (Plain Old CLR Objects), which are entities with get/set properties of different types. This model is used when querying and saving entity data to the underlying database.
- Change Tracking: By using the SaveChanges method of the context, EF tracks changes to entities and their relationships and ensures the correct updates are performed on the database. Change tracking is enabled by default in EF but can be disabled by setting the AutoDetectChangesEnabled property of DbContext to false.
- Saving: Upon calling the "SaveChanges()" method, EF executes the INSERT, UPDATE, and DELETE commands to the database based on the changes made to entities. "SaveChangesAsync()" is another asynchronous method provided by EF.
- Concurrency: EF provides built-in support for Optimistic Concurrency to prevent an unknown user from overwriting data from the database.
- Transaction: EF's transaction management capabilities automate the querying and saving of data. Furthermore, you can customize the way that transactions are managed.
- Caching: First-level caching of entities is supported out of the box in the EF. Repeated queries will retrieve data from the cache RATHER than the database in this case.
- Built-in Conventions: EF conforms to the conventions of configuration programming and has a set of default settings that automatically configure the model.
- Configuration: By using the data annotation attribute or Fluent API, we can configure the EF model and override the default conventions.
- Migrations: EF provides migration commands that are executable on the command-line interface or NuGet Package Manager Console to incrementally update the database schema to keep it in sync with the application's data model.
|