I have a very simple query that would look like this
select *
from job
where jobId like '%23%'
or title like '%23%'
I need to be able to replicate this using dynamic Linq
The closest i've come to is this, but it doesn't work
.Where("@0.Contains(jobId) or title.Contains(@0)", "23");
Has anyone got a solution to this, ideally I would like it to do a like on both int's and strings
addendum based on comments
The error is:
An exception of type 'System.Linq.Dynamic.ParseException' occurred in System.Linq.Dynamic.dll but was not handled in user code Additional information: No applicable method 'Contains' exists in type 'String'
The jobId
field is an int
, while title
is a varchar
.