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
Tag: LINQ to SQL
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!
Code Generation – Blessing or Curse?
There are lot of code generation tools available. Microsoft Visual Studio has had code generation possibilities since I started using it in the mid 90-ties. Code generation can be a blessing for getting something up and running quickly, but also a curse when maintaining code. Whenever a code generation tool is considered, there are two… Continue reading Code Generation – Blessing or Curse?
Using Transactions for Unit Tests
Unit tests should preferably be independent of external services, systems and files. The standard way to achieve this is to create mocks. A mock is an object that can be used in place of the real resource and act in a predictable way to ensure the tests always give the same result. I think that this is… Continue reading Using Transactions for Unit Tests
Always Check Generated SQL
In my last post I advocated for using LINQ to SQL for data access. Today I am going to show an example of how the greater power of LINQ compared to SQL sometimes results in terrible performance when LINQ to SQL does it best to work around the limitations of SQL. var q = from… Continue reading Always Check Generated SQL