Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 13, 2012 12:29 AM by Decker Dong - MSFT
Nov 12, 2012 12:03 PM|LINK
If I have an entity with 10 string properties, how can I search all ten properties with a LIKE condition?
For example, in SQL:
SELCT * FROM suppliers
WHERE supplier_name LIKE '%bob%'
How can you accomplish this in EF? Thanks in advance.
Nov 12, 2012 12:08 PM|LINK
you can use the contains or StartsWith keyword. Some thing like
Nov 12, 2012 12:52 PM|LINK
Ok, but do I have to look in all fields manually?
If so I can just write a method once and put it in the repository, however I thought there would be an easier way of doing this. What if my entity had 30 string fields? I have to check each one... seems a bit much.
Nov 13, 2012 12:29 AM|LINK
For a very complicated issue of searching, I suggest you to package that into the EF by referring the Stored Procdure, and then directly use that instead.
For more you can refer to this: