Archives
-
Entity Framework Pitfalls: Cannot Return Complex Types From SQL Queries
Clarified: thanks, Diego!
-
Entity Framework Pitfalls Index
Updated on January 16th
-
Entity Framework Pitfalls: Concrete Table Inheritance and Identity Keys
When using the Concrete Table Inheritance / Table Per Concrete Type pattern for mapping entity inheritances, you cannot use IDENTITYs as primary keys. It is easy to understand why: because each entity of a concrete type is stored in its own table, and if these tables would be using IDENTITYs for generating the primary key, if we would issue a query on their base class looking for a record by its primary key, Entity Framework would generate lots of UNIONs, one for each table, where only one could possibly return a record.
-
Entity Framework Code First Table Splitting
Since Entity Framework does not support lazy scalar properties, only lazy references and collections, in order to avoid automatic loading of columns with large contents – BLOBs or CLOBs – we can use a technique called table splitting. In a nutshell, this means using multiple entities to store the columns of a table, say, one for the core, and another for the heavy columns.
-
Entity Framework Pitfalls: Validation Does Not Load Lazy Properties
In a nutshell: Entity Framework Code First (EFCF) validation does not load lazy properties. If any of these properties is marked as required, and it is not loaded, a validation error will occur.
-
Mapping Non-Public Members With Entity Framework Code First
This is a common request, and really makes sense; we need to use LINQ expressions and a bit of reflection magic. First, an helper function for returning an expression that points to a member:
-
Caching LINQ Queries
Some days ago I wrote a post on comparing LINQ expressions where I shared my discoveries and general discontent on how difficult it is do right. The reason I was looking into it was because I wanted to write a LINQ query caching mechanism.
-
Five Years of Blogging
Five years have passed since my first post, which occurred just after the creation of this blog. It was my first “social” experience on the Internet, and I learned a lot from it.