I have a list of string:
List
I have a Entity:
Entities context = new Entities();
with table EmployeeMaster and column EmployeeName
I want to write 2 linq queries
1. for matching exact match on employeeName as per list items
2. for matching substringmatch on employeename as per list items
Please let me know both queries.
Thanks in advance
Pradeep ShetPosted Nov 24, 2014, 3:10 AM
Use the below code,
var matchedrows = context.EmployMasters.Where(x=>lst.Equals(x.EmployeeName)).Select(y=>y).ToList();
var partialMatchedRows =
context.EmployMasters.Where(x=>lst.Contains(x.EmployeeName)).Select(y=>y).ToList();
Hope this answers your query, plz mark it as answered if it helped you.