I have run into a problem with an IConcurrencyPredicateFactory. It is as follows:
public class PersonConcurrencyFilterFactory : IConcurrencyPredicateFactory
{
public IPredicateExpression CreatePredicate(
ConcurrencyPredicateType predicateTypeToCreate, object containingEntity)
{
IPredicateExpression toReturn = new PredicateExpression();
PeopleEntity person = (PeopleEntity)containingEntity;
switch (predicateTypeToCreate)
{
case ConcurrencyPredicateType.Save:
// only for updates
toReturn.Add(PredicateFactory.CompareValue(PeopleFieldIndex.DrawDate,
ComparisonOperator.Equal, person.Fields[(int)PeopleFieldIndex.DrawDate].DbValue));
break;
}
return toReturn;
}
}
The problem is that it fails when comparing a person.Fields[(int)PeopleFieldIndex.DrawDate].DbValue is null. It seems this failure is due to ANSI_NULLS being on. If off all works ok. Is there some other way to code this comparison that will not fail with ANSI_NULLS on?