Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello,

I have taken one filter control and one data grid in the win app. I am using entity framework for pull the data from DB. Earlier version filter control returns string in the form of sql statement so that i can use directly in the where condition of sql query but here in the new version of devExpress returning a string into entity-framework's string statement.

What I have tried:

older filter control string
Select Id, Name, Mobileno, EmailId, City from Usermaster where Name IN ('abc','xyz') and City not in ('abc') or City like 'abc%' or City like '%abc'

Now in Filter Control string for example
var blog = dbContext.Usermaster.Where(b => b.Name == 'abc').ToList();

I am not able to make where string dynamically as above in written in the query. Can some one help on this.?
Posted
Updated 30-Jun-16 22:38pm

1 solution

You can try to use String.Contains for robust lookup instead of equality comparison.

C#
var blog = dbContext.Usermaster.Where(b => b.Name.Contains("abc")).ToList();
 
Share this answer
 
Comments
Niravvasoya 1-Jul-16 4:57am    
How can we do dynamically with multiple columns? because column name and operators are not fixed it will come any.

var blog = dbContext.Usermaster.Where(b => b.Name.Contains("abc") ).ToList();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900