It is natural to think of the public methods and properties of a class as the public interface of the class. When implementing a class that is meant to be derived there is also another interface – the one meant for child classes. A clear separation of the two interfaces makes the code cleaner. The… Continue reading Keep Public Interfaces away from Children
Category: C#
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
Updating EntitySets with LINQ2SQL
This post is written by guest blogger Albin Sunnanbo. He’s a great friend and source of inspiration and also one of the best developers I know. It was Albin that first introduced me to LINQ, EF Migrations and jQuery that I now use daily. I often find myself in situations where I need to update… Continue reading Updating EntitySets with LINQ2SQL
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