Jeff wrote:
i agree completely. I am trying to convince them to go this route. However, regardless i would like to know if it is possible with llblgen to execute my own sql and param collection, and how you would do that?
To use the SOUNDEX feature in your code, you can opt for creating a new predicate class, which you build using the code from FieldLikePredicate. Just copy the code over from that class in teh runtime libraries code to a class in your own project. Then, alter the ToQueryText in such a way that you instead of emitting:
queryText.AppendFormat("{0} LIKE {1}",
base.DatabaseSpecificCreator.CreateFieldName(_field, _persistenceInfo, _field.Name, _objectAlias, ref uniqueMarker, inHavingClause),
parameter.ParameterName);
you do:
queryText.AppendFormat("SOUNDEX({0}) = SOUNDEX({1})",
base.DatabaseSpecificCreator.CreateFieldName(_field, _persistenceInfo, _field.Name, _objectAlias, ref uniqueMarker, inHavingClause),
parameter.ParameterName);
(just remove the case sensitive code)
Then, when you produce the filter, use something like:
PredicateExpression filter = new PredicateExpression()
filter.Add(new FieldSoundExPredicate(EntityFieldFactory.Create(CustomerFieldIndex.ContactFirstName), "John"));
(this is selfservicing, if you use adapter, you've to pass in null as second parameter)
which will then become:
WHERE SOUNDEX([Customer].[ContactFirstName]) = SOUNDEX(@param1)
you can combine them ofcourse with normal predicate expression code.
If you need further help, please let me know.