It's probably because i do not (yet) understand the full range of power of the llblgen generated code and therefore am not using it right,
But this issue is keeping me busy for some time now, so i want to post it to see what's going on.
I use the LLBLGendatasource bound to a gridview. The data comes from 1 table TUser.
there is a unique constraint on the field UserName.
When one row is updated and the username is changed to a username already existing, an exception is thrown in the following generated code in the TUserEntity class:
/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
/// <returns>true if succeeded, false otherwise</returns>
protected override bool UpdateEntity()
{
TUserDAO dao = (TUserDAO)CreateDAOInstance();
return dao.UpdateExisting(base.Fields, base.Transaction);
}
There is no way for me to catch this exception, other than altering this method myself and enclose it in try catch block, but since it is generated code, that can never be the intention, is it?
I read some posts about having to use validatebeforesave to do my own validation, but oughnestly i do not really know where to start. Do i have to do this for every entitytype? Where should i overload the classes?
Can someone get me started in doing checks for unique constraints in such a way that i can detect or catch errors and display them correctly to the user?
I use the LLBLGenDataSource as SelfServicing and tried both livepersistance true and false.
Thanks a lot!