Hi
I've a problem with validations
I'm doing cross object validations, for example I've an Employee and an EmployeeTl entity, the link is done by EmployeeTl.EId = Employee.EId.
Now, I've overrided the FetchEntity and FetchEntityCollection to be sure to always have an EmployeeTl fetched with an Employee. So that in my validations I can check data are in a consistent state between the 2 objects.
The problem is :
In the EmployeeValidator or EmployeeTlValidator when I check some data from the other object I can get a OutOfSync exception because the other object is allready saved.
For example from an EmployeeTlValidator I try to access to Employee.Anyfield but the Employee is allready validates and then saved, so I got an OutOfSync exception
Ok my first reaction, I put the refetch after save to true. But ... this is the way it should work :
1) Employee is validate
2) Employee is saved
3) Employee is refetched
4) EmployeeTl is validated
3) EmployeeTl is refetched
4) EmployeeTl is refetched
but in point 3 --> bing exception. My overrided fetch method don't find any EmployeeTl related to the Employee, because the EmployeeTl is not yet saved !!
So my questions :
1) Is there any way to make ALL validations (on ALL objects) before starting persistance actions ? The OutOfSync problem will be there for all validations between objects, it's annoying and refetch only for validations is not very optimized ...
2) Is it a way to know if we are in a "normal" fetch or in a refetch after save ?
Thanks you