im new to EF and "in the old days" i'd just if i was doing a search option use where clause with % wildcards...
Hi,
There's no direct "%" in the SQL statement, so you can just bind your Entity Model to a Stored Procdure with something like "%" and then fetch out all the values.
metase_jl
Member
91 Points
120 Posts
how to add wildcard to where clause with EF
Nov 08, 2012 01:29 AM|LINK
im new to EF and "in the old days" i'd just if i was doing a search option use where clause with % wildcards...
how would i go about doing the same with ef?
entity data framework wildcard EF where
tdykstra
Contributor
4444 Points
621 Posts
Microsoft
Moderator
Re: how to add wildcard to where clause with EF
Nov 08, 2012 03:03 AM|LINK
You can use string functions like Contains in the Where clause, e.g.:
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application
Nick Asiimwe
Participant
1459 Points
643 Posts
Re: how to add wildcard to where clause with EF
Nov 08, 2012 03:39 AM|LINK
check these links
http://trentacular.com/2010/08/linq-to-entities-wild-card-like-extension-method/
http://stackoverflow.com/questions/835790/how-to-do-sql-like-in-linq
Sincerely,
Nick
ASP.NET, SQL Server [Database Engine, SSIS & SSRS],Entity Framework, C# and VB.NET
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: how to add wildcard to where clause with EF
Nov 09, 2012 12:25 AM|LINK
Hi,
There's no direct "%" in the SQL statement, so you can just bind your Entity Model to a Stored Procdure with something like "%" and then fetch out all the values.
entity data framework wildcard EF where