Archives
-
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.
-
Convert HTML to Well-Formatted Microsoft Word Document
Recently I wanted to convert my LINQ via C# tutorial into a Word document (.doc). The tasks are:
-
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.
-
Use Fiddler with Node.js
Fiddler is an useful HTTP proxy debugger on Windows. It would be nice if it can work with Node.js applications. To do this, just need to proxy Node.js requests through Fiddler. The default proxy is 127.0.0.1:8888. This can be viewed in Fiddler Tools –> WInINET Options –> LAN settings –> Advanced:
-
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:
-
Understanding C# Features (8) Covariance and Contravariance
[LINQ via C#] - [C# Features]