I wonder if anyone has used the DifferenceExpression, I am trying to use it to do a sounds like search on person names when our user checks the sounds like check box
I then have this code snippet below when creating the criteria
Code:
if (enableSoundex)
{
disjunction.Add(new DifferenceExpression("Surname", submittedName, DifferenceExpression.Strength.Strong));
}
else
{
disjunction.Add(Expression.Eq("Surname", submittedName));
}
The problem is that when the soundex search is hit the generated sql is correct, but the parameter is not sent to the database with the query.
If the soundex isnt selected and it runs the equal expression the sql and parameters are all sent to the database correctly
Am I using the DifferenceExpression correctly? Do I have to do something else to ensure the parameter is sent with the query?
The sql sent to the db is below (its quite long so I have just included the end of the query as thats the part where I am having problems). You can see at the end of the query it is making reference to @p1 parameter, but it is not in the parameters at the end of the query-
Code:
exec sp_executesql N'... WHERE (Difference(@p1, familyname2_.Name) >= 3) and personname1_.Id = name1_.Id) ORDER BY name1_.Active desc',N'@p0 bit',@p0=1
Worth noting is that if I try to run the query manually adding the parameter to the end myself, the query runs producing the desired results
Ment to mention, the inner exception error picked up by visual studio is
Quote:
{"Must declare the scalar variable \"@p1\"."}