Hi,
Your Linq query is formatted wrongly I think.
var q = from row
in DataContext.CreateQuery<WorkItem>(TableName)
where
CustomCompare(p_strRowPK,row.RowKey)
select row;
would be equal to:
var q = from row
in DataContext.CreateQuery<WorkItem>(TableName)
where true
select row
;
This is not a valid Linq query. I think you should write something like:
var q = from row
in DataContext.CreateQuery<WorkItem>(TableName)
where
row.RowKey.CustomCompare(p_strRowPK) == true
select row
;
You'll have to make ann extension method of the CustomCompare method for the String type of course:
public static bool CustomCompare(this
string p_strTestedRowKey, string
p_strFilterRowKey)
{
string[] arrFilterValues = p_strFilterRowKey.Split(new
string[] {
"," }, StringSplitOptions.RemoveEmptyEntries);
string[] arrTestedValues = p_strFilterRowKey.Split(new
string[] {
"," }, StringSplitOptions.RemoveEmptyEntries);
int intEqualityCounter =
0;
if (arrFilterValues.Length
== arrTestedValues.Length)
{ for (int intCurrentIndex
= 0; intCurrentIndex
< arrTestedValues.Length; intCurrentIndex++)
{
// They are either equal or the filter is empty for a certain value
if (arrFilterValues[intCurrentIndex]
!= string.Empty
|| arrTestedValues[intCurrentIndex]
== arrFilterValues[intCurrentIndex])
{
intEqualityCounter++;
}
}
}
return intEqualityCounter == arrFilterValues.Length
&& intEqualityCounter == arrTestedValues.Length;
}
With regards,
Patriek
www.patriekvandorp.net
If this reply is of help to you, please don't forget to mark it as an answer.