Entity Framework¶
Stable
Entity Framework (EF) is an open-source Object-Relational Mapper (ORM) framework for .NET.
| Property | Value |
|---|---|
| Current Version | EF Core 10.x |
| Forge Compatibility | Forge 3.0 (.NET 10) |
| Status | Stable |
Description¶
Entity Framework (EF) is an open-source Object-Relational Mapper (ORM) framework for .NET, developed by Microsoft. It enables developers to interact with databases using .NET objects, eliminating the need to write most of the data-access code typically required in applications.
EF Core supports multiple database providers including SQL Server, Oracle, Cosmos DB, and PostgreSQL.
Why we use it¶
Entity Framework is used to map database objects to C# objects, which makes it easier to create database interactions. We currently use it for:
- Oracle databases - Database-first approach for legacy data
- Cosmos DB - Code-first approach for new applications
- SQL Server - Both code-first and database-first approaches
When to use it¶
- ✅ Data access layer for relational databases
- ✅ Cosmos DB integration via the Cosmos DB provider
- ✅ Database migrations and schema management
When to consider alternatives:
- ⚠️ Extreme Latency Sensitivity: Scenarios requiring sub-millisecond optimization where even the minimal overhead of object tracking/mapping is too costly.
- ⚠️ Complex Reporting/Analytics: Queries involving hundreds of lines of SQL, CTEs, or window functions where LINQ generation might be unpredictable or harder to optimize than hand-written SQL.
- ⚠️ Massive Bulk Operations: While
ExecuteUpdatehandles many cases, inserting millions of rows may still be faster with raw SQLSqlBulkCopyor specialized bulk libraries.
Prerequisites¶
- .NET 10 SDK
- Database connection (Oracle, Cosmos DB, SQL Server, etc.)
- EF Core CLI tool (optional, for migrations)
Related Documentation¶
| Guide | Description |
|---|---|
| Cosmos DB NoSQL | Using EF Core with Cosmos DB |
| Oracle Database | Using EF Core with Oracle |