[NoBrainer] Cascading Lambda Expression in C#

While Converting ODataQueryOptions into LINQ Expressions I needed to cascade different Lambda Expressions via AND and OR. In this post I describe a way on how to easily combine them via a boxing class with operator overriding. The Problem Cascading lambda expressions should be as easy as using a + or && operator: A boxing […]

Converting ODataQueryOptions into LINQ Expressions in C#

OData makes it very easy for us to pass query options from the URL down to an object mapper like EntityFramework. However, this somehow happens automagically and cannot be really controlled in code. In this blog post I show how we can extract and convert FilterQueryOption and OrderByQueryOption to manually apply them to our underlying […]

LINQ to Entities and AutoMapper mapping conventions

The other day I was trying to map a class to some other class, nothing unusual – especially when we use AutoMapper for that task. However the error I got was really unexpected: Here is how my classes looked like: What happened? The error occurred when I tried to convert my Attribute to a NameValuePair […]

[NoBrainer] C# and IEnumerable.ForEach

By default we cannot use ForEach() on IEnumerable but only on List. However, with extension methods to the rescue, it is easy to roll your own: Regarding the implementation I saw a few options: I could implement ForEach() with a traditional for loop, parallelise the operation, use ToList() to convert the list or other LINQ […]