LinQ and Entity Frameworks are both commonly used in the .NET ecosystem, however, even well-written applications can have LINQ queries that are hard to understand. This is because LINQ is very flexible making it written in ways in which it fail to communicate with the developers intent. A well-written LINQ should be clear and self-documenting.
In this article, we’ll be showing you how to use pipe, filter, and rule pattern to make LINQ queries easier to understand. We will start by taking a look on how we can extend the Where method by creating custom filters which can take advantage of IQueryable extension methods. Then after that, we evaluate expression trees to understand how they work and how to manipulate it for maximum usability.
Read the rest of the post here:Â https://www.simple-talk.com/dotnet/.net-framework/giving-clarity-to-linq-queries-by-extending-expressions/