Hello,
Im using VS2010 ult. LLBLgen V3.5
At the moment im working on a test project to get my validation layer right (before i build it into my application).
Im using injection validation, and override the fieldvalidate classes etc.
My test project has two entities -> very basic, some fields allow null, some not etc.
I created a new Win Forms, added one of my entities as a "DataSource" en created a detail screen of my entity, resulted in a bindingsource with a binding navigator.
In the validation class, i created a validation rule in the "OnValidateFieldValue" that checks if the name of the entity has a length of 4.
On my form a created a save button, and in the "On_Click" method, the following code is created:
try
{
InboundInterfaceEntity i = (InboundInterfaceEntity)inboundInterfaceEntityBindingSource.Current;
inboundInterfaceEntityBindingSource.EndEdit();
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.SaveEntity(i, true);
}
}
catch (ORMEntityValidationException v)
{
frmValidationResults a = new frmValidationResults();
a.ValidationMessages = v.Message;
a.ShowDialog();
errorProvider1.UpdateBinding();
return;
}
catch (Exception ex)
{
throw;
}
Allright, so i run the form, details of the first entity are shown in the form and i change then name of the entity to five characters, i don't leave the textbox (that would directly cause the "onvalidatefieldvalue" but i hit the SAVE button.
In the On_Click method (see above) i call the Bindingsource.EndEdit() function. This function cause an ORMValidationException in the "OnValidateFieldValue" override -> but in the above code the Exception is not Catched, even if i add a "Exception" catch, it doesn't get in that.
How can i catch the message (so i can properly stop the save routine etc).
Just to be sure, this only is the problem when the cursor is still in the textbox and i hit the save button.
Regards,
Joey