Hi,
it takes an xpath string as input and a list of values, creates an exist query from it.
What would I gain from inheriting from an existing predicate? Wouldn't it be necessary to overwrite the method in DataAccessAdapter then?
The code from ToQueryText:
uniqueMarker++;
string fieldName = this.DatabaseSpecificCreator.CreateFieldName(field, persistenceInfo, field.Name, this.ObjectAlias, ref uniqueMarker, inHavingClause);
StringBuilder newPath = new StringBuilder(256);
newPath.AppendFormat("({0}).exist('(",fieldName).Append(xPath);
if (this.values != null && this.values.Count > 0)
{
newPath.Append("[");
bool first = false;
int counter = 1;
foreach (string val in this.values)
{
if (!first)
{
first = true;
}
else
{
newPath.Append(" or ");
}
newPath.Append("contains(.,sql:variable(\"{{").Append(counter).Append("}}\"))");
counter++;
}
newPath.Append("]");
}
newPath.Append(")')=");
if (base.Negate)
{
newPath.Append("0");
}
else
{
newPath.Append("1");
}