I need to select rows from database table using filtering by xml-type column.
table looks like (short version)
id
dbfield int
xmlfield xml
and i m filtering it in this way
IQueryable<Data.entity> q = from u in datacontex.entities
select u;
if (val1.HasValue)
q = q.Where( x => x.dbfield > val1.value)
if (val2.HasValue)
q = q.Where( x=> x.dbfield < val2.value)
if (!string.IsNullOrEmpty(searchString))
q = q.Where ( x=> x.xmlfield contains values from searchString)
XML in xmlfield is very simple it looks like
<doc>
<item id="no">test/WZ/2009/04/02</item>
<item id="title">blabla</item>
...
The question is how to add WHERE condition in linq and preferably this contition should translate to ms-sql query, without processing dataset on webservice application.
Thanks.