MVC and Entity Framework scaffolding is powerful, but I prefer to know what actually happens before accepting generated code. The code generated to update an entity when an edit has been done looked interesting, so I decided to have a closer look at it. When an edit is done to an entity, the data is… Continue reading Dissecting MVC Scaffolded Code for EF Updates
Tag: Entity Framework
Null Sematics in LINQ’s Sum
C# LINQ code is not always executed as C# code. With LINQ-to-SQL or Entity Framework it is translated into SQL instead. This can bring unpleasant surprises when things that can’t happen do happen. One day when you’re deep in the zone coding a marketing specialist shows up with a haunted look because the CEO wants… Continue reading Null Sematics in LINQ’s Sum
Always Check Generated SQL
OR-Mappers are great for making data access easier, but they are not an excuse for learning SQL. As an application developer, I’m responsible for all the SQL queries issued by the application. If I use an ORM, it’s my responsibility to check the generated SQL. I’ve already written another post named Always Check Generated SQL… Continue reading Always Check Generated SQL
IQueryable Read Model Extension Methods
The normalized data model of the database is often not suitable for reading and displaying data. A separate read model used to represent all the data needed to display a page improves performance. Defining the read model is only half the work though, to make it really usable the read model should accept queries in… Continue reading IQueryable Read Model Extension Methods
Don’t use Linq’s Join. Navigate!
One of the greatest benefits of LINQ to SQL and LINQ to Entities is navigation properties that allows queries across several tables, without the need to use explicit joins. Unfortunately LINQ queries are often written as a direct translation of a SQL query, without taking advantage of the richer features offered by LINQ to SQL… Continue reading Don’t use Linq’s Join. Navigate!