Hi Kioko,
Will try to illustrate with an example. This is an approximate code to validate that:
public void SaveClassRegistration(ClassRegistration toSave)
{
// validate the student registration
int times = (int)orderDetails.GetScalar(ClassRegistrationFieldIndex.ClassId,
null, AggregateFunction.Count, (RegistrationClassFields.StudentId == toSave.StudentId));
if (times >0)
{
throw new Exception("Dude already there");
}
toSave.Save();
}
As this is a cross-entity validation (multiple entities are involved) you must do that in your business class (or inside your entity collection as a custom method). Here is more information about Validation.