I'm using entity framework and I will recieve a dictionary of objects in the controller and that will help me to create a predicate on the repository.
I don't know how to create a dynamic predicate using the Dictionary Keys and Values. All Keys will be named as entity properties, that means that on the followed example, the entity person have a property called Surname, and I want all Items with the surname Elliot.
Dictionary<string,Obect>()
With the followed data Key/Value:
- "Surname","Elliot"
Once you master the art of building dynamic queries life becomes easy.
Method 1 :
You can use dynamic linq expressions.
You have to use Dynamic Linq from NuGet
Once you have Dynamic Linq, you can write strings as queries and pass it as string in your where clause
For more information visit
Method 2:
Follow this link