Thursday, March 24, 2016

Building LINQ Expressions Dynamically

I recently had a requirement to chain together LINQ Expressions and oddly enough, I could not find an easy way to accomplish this!!

You can read more about this dilemma here: https://www.simple-talk.com/dotnet/.net-framework/giving-clarity-to-linq-queries-by-extending-expressions/

Fortunately, I found a library to accomplish this written by the same author of LINQPad: http://www.albahari.com/nutshell/predicatebuilder.aspx

Unfortunately, from this article it is not obvious that this library belongs to the NuGet Package LINQKit: https://www.nuget.org/packages/LinqKit/

You can read more about LINQKit here: http://www.albahari.com/nutshell/linqkit.aspx

In addition, there are several other libraries such as PredicateExtensions which assists with this as well: https://github.com/EdCharbeneau/PredicateExtensions

It is also available as a NuGet package: https://www.nuget.org/packages/PredicateExtensions/

Unfortunately, the PredicateExtensions NuGet package is not strongly signed, so you may encounter problems with using this assembly in your own strongly signed projects.




No comments:

Post a Comment