I have a collection of customers "_cc" and each customer has a collection of orders.
I created a concurrency class:
public class **CustomerConcurrencyFilterFactory **: IConcurrencyPredicateFactory
{
...
}
and set this class to the collection's **ConcurrencyPredicateFactoryToUse **
_cc.ConcurrencyPredicateFactoryToUse = new CustomerConcurrencyFilterFactory();
_cc.SaveMulti();
The **CustomerConcurrencyFilterFactory **never is called though. I do ensure that there are customers with dirty data. In fact the customer's changed data does save.
Any idea why the **CustomerConcurrencyFilterFactory **is not called?
Here is the full class:
public class CustomerConcurrencyFilterFactory : IConcurrencyPredicateFactory
{
public IPredicateExpression CreatePredicate(
ConcurrencyPredicateType predicateTypeToCreate, object containingEntity)
{
IPredicateExpression toReturn = new PredicateExpression();
CustomersEntity customer = (CustomersEntity)containingEntity;
switch (predicateTypeToCreate)
{
case ConcurrencyPredicateType.Delete:
toReturn.Add(CustomersFields.Country == customer.Fields[(int)CustomersFieldIndex.Country].DbValue);
break;
case ConcurrencyPredicateType.Save:
// only for updates
toReturn.Add(CustomersFields.Country == customer.Fields[(int)CustomersFieldIndex.Country].DbValue);
break;
}
return toReturn;
}
}