Extending LINQ Expressions

In the previous post we looked into what expression trees are and how they can be used. While this is enough most of the time, you may find yourself wondering if you can extend expressions. This might especially be the case if you are constructing expression trees directly via factory methods and you just need to pass some additional data which is relevant only for your application. In this post we will look into what is possible and how infrastructure handles extensions.

Read on →

LINQ Expressions

It has been quite some time from my last blog post. With getting used to new job and new found love for mountain hiking I didn’t have as much time as I would have liked for writing. However, now I have a topic that I really like since I worked with LINQ expressions for some time and I find them really powerful. In this post I will explain what LINQ expressions are and where they are used.

Read on →

Dynamic Query Expressions With Entity Framework

When you use Entity Framework for data access and you need to retrieve data from data store, you usually write LINQ expression. LINQ provides fluent syntax for expressing what data we are interested in. And since syntax is the same for querying in-memory collection or external data store, I never really look into what the difference is and how queries are actually constructed. Until the day that I was designing API which allowed client to sort on any field. While I could create if/else or switch statement covering all possibilities, this would be boring, error prone and unmaintainable. And there is a better way.

Read on →

Profiling Unit Test in Visual Studio Community 2015

When I was running some unit tests and was waiting for completion I saw one that took more than 3 seconds to complete. There were some tests that I knew took long but this one was not one of them. So now the question was whether this was due to testing framework or my code was to blame.

Read on →