Hi, for user concurrency we are implement a predicate. Our database in mysql is using timestamp with 3 digits of precision.
Our class:
private class OrderConcurrencyFilterFactory :
IConcurrencyPredicateFactory
{
public IPredicateExpression CreatePredicate(
ConcurrencyPredicateType predicateTypeToCreate, object containingEntity)
{
var toReturn = new PredicateExpression();
var compta = (ComptadorEntity)containingEntity;
switch (predicateTypeToCreate)
{
case ConcurrencyPredicateType.Delete:
toReturn.Add(ComptadorFields.Lastupdate== compta.Fields.GetDbValue((int)ComptadorFieldIndex.Lastupdate));
break;
case ConcurrencyPredicateType.Save:
// only for updates
toReturn.Add(ComptadorFields.Lastupdate == compta.Fields.GetDbValue((int)ComptadorFieldIndex.Lastupdate));
break;
}
return toReturn;
}
}
The problem is that if we use timestamp(3) we received and exception error when we try to save the entity, if we use timestamp without precision, we don't received any error and the entity is saved.
So i think the problem is here:
toReturn.Add(ComptadorFields.Lastupdate == compta.Fields.GetDbValue((int)ComptadorFieldIndex.Lastupdate));
the mysql sentence generated:
UPDATE `comptador` SET `numero`=69 WHERE ( ( `comptador`.`id` = 1) AND ( ( `comptador`.`lastupdate` = '20191217124239')))
As we can view, the precision of timestamp is not correct, and for this we received and exception error when we save the entity
Please any help of "guru"
Thanks