I have a List
of type String
in which it has values with same name as properties in my Entity class,
For example,
I have List<string>
List<String> list = new List<String>(new String[]{ "Name", "Age", "Value" });
Now I have to query my table using LinqtoEntities
using values in my list
like so:
db.Mytable.Where(z=>z.MyListValue1==SomeValue && z.MylistValue2==SomeValue &&
z.MyListValue3==SomeValue)
Is this possible? Or is there other workaround for doing like this?
because my List<string>
values are same as my Class properties
I am using DB FIRST approach with EF5 ,Mvc5 and Oracle11g
You can use Contains
:
db.Mytable.Where(z => list.Contains(z.YourPoperty))