LINQ (Language Integrated Query) has been one of the greatest addition in the .NET Framework which really changed the way we code and how ORM are now working.
But thing we do are not always static, we need to order from parameter value in query string, filter with a user formula from text box, select field from a configuration in SQL and all this thing is not always possible with strongly-typed query and require to use LINQ in a dynamic way.
So what are the available options to use LINQ dynamically in Entity Framework?
I'm the library owner.
This library is more than a LINQ Dynamic library, it’s the ultimate solution to evaluate and compile almost all C# code at runtime.
- Complete expression evaluator
- Use LINQ Syntax
- Unmatched flexibility
Even if the FREE version is limited to 50 characters, this should be more than enough for almost every dynamic query you will have to create.
- FREE version limited to 50 characters
- Recent Library
As soon as you talk about “dynamic”, Eval-Expression.NET is the answer. Almost every operators and keywords are supported including anonymous type, generic type, lambda expression, LINQ extension methods and more!
It’s the easiest expression evaluator library to learn and the most flexible.
System.Linq.Dynamic (Dynamic Query Library)
This library is the most used solution and will probably do everything you need to do even if it’s not as flexible as the Eval-Expression.NET solution.
- Most user && well-known solution for dynamic expression
- Free & Open Source
Not following the LINQ Syntax can also be an advantage since it make ordering multiple column easier.
- Don’t follow LINQ Syntax
- Limited (Do not support all methods)
- Not supported for original owner (Microsoft)
Microsoft is the original owner of the library but since they have no website for this library or people supporting it, we recommend to use the version you can found in King Wilder repository on GitHub.
If you have question, the best chance to get your answer is from Stack Overflow.
Both library are very good choice, I have used Dynamic Query library in the past and never had any problem and really enjoyed the flexibility over static method.
However, if you need to create LINQ query dynamic, there is a very good chance that you will perform some other operations dynamically also and Eval-Expression.NET is the solution for this.
Share your experience
- What's features is missing?
- Which library are you using and why?