Contents tagged with Entity Framework
-
EntityFramework.Functions: Code First Functions for Entity Framework
EntityFramework.Functions library implements Entity Framework code first support for:
-
Entity Framework and LINQ to Entities (4) Query Methods
This part discusses how to query SQL database with the defined mapping classes. Entity Framework and LINQ to Entities supports most of the extension methods provided by Queryable class:
-
Entity Framework and LINQ to Entities (6) Deferred Execution, Laziness Loading and Eager Loading
In LINQ to Objects, query methods returning IEnumerable<T> implements deferred execution. Similarly, in LINQ to Entities, query methods returning IQueryable<T> implements deferred execution too.
-
Entity Framework and LINQ to Entities (3) Logging
As fore mentioned, this tutorial will use SQL Profiler to trace the remote SQL queries, which are translated from the LINQ to Entities queries. This is most close the the truth, because the tracing uncovers the actual SQL query executed in SQL database. Entity Framework also provides several options to log the translated SQL database operations programmatically.
-
Entity Framework and LINQ to Entities (5) Query Translation
The previous part discussed what SQL queries are the LINQ to Entities queries translated to. This part discusses how the LINQ to Entities queries are translated to SQL queries. As fore mentioned, IQueryable<T> query methods work with expression trees. Internally, these methods build expression trees too, then these expression trees are translated. In Entity Framework, .NET expression tree is not directly translated to SQL query. As mentioned at the beginning of this chapter, Entity Framework implements a provider model to work with different kinds of databases like Oracle, MySQL, PostgreSQL, etc., and different database system can have different query languages. So Entity Framework breaks the translation into 2 parts:
-
Entity Framework and LINQ to Entities (2) Object-Relational Mapping
.NET and SQL database and have 2 different data type systems. For example:
-
Entity Framework and LINQ to Entities (10) Performance
The previous parts has discussed a few aspects that can impact the performance of Entity Framework and LINQ to Entities, and here is a summary:
-
Visual Studio Entity Data Model Wizard Not Responding
This post is for the issue that Entity Data Model Wizard becomes not responding. In Visual Studio 2015, when clicking the Finish button to create the entity data model from SQL Server 2014 SP! database, the wizard is frozen:
-
Entity Framework and LINQ to Entities (9) Optimistic Concurrency
Conflicts can occur if the same piece of data is read and changed concurrently. Generally, there are 2 concurrency control approaches:
-
Entity Framework and LINQ to Entities (8) Transactions
As discussed above, by default DbContext.SaveChanges execute all data creation, update and deletion in a transaction, so that all the work can succeed or fail as a unit. The following example tries to update 2 entities, so there will be 2 UPDATE statements in the transaction:
-
Entity Framework and LINQ to Entities (1) IQueryable<T> and Remote Query
The previous chapters discussed LINQ to Objects, LINQ to XML (objects), and Parallel LINQ (to Objects). All of these APIs query in memory objects managed by .NET. This chapter discusses Entity Framework, a Microsoft library providing a different kind of LINQ technology, LINQ to Entities. LINQ to Entities can access and query relational data managed by different kinds of databases, e.g.:
-
Entity Framework and LINQ to Entities (7) Data Changes
Besides LINQ to Entities queries, Entity Framework also provides rich APIs for data changes.