I need some advice on how to best deal with this scenario (using VS2005 and LLBL v2.6 and DevExpress ASPXGrid)
I have a table with an autoincrement PK and two non-null character fields, Name and Description. The web page is a no-frills grid with an edit form for inserting and updating. When the user leaves Name or Description blank and attempts to insert, the db throws the "can't insert null into a non-null column" exception and is shown to the user. So the user corrects the situation and supplies a value for the field that was null, and tries to save again.
Looking at the uow.GetEntityElementsToInsert() in the debugger, it now contains two elements. The first with the null value that failed to insert, and the second with the corrected non-null value. So uow.Commit() fails again, when the first element is attempted to be inserted.
What I've done to work around it, is catch the exception that happens on uow.Commit() and issue uow.Reset() and then rethrow the exception so the exception is seen by the user. It seems like there ought to be a better way, and any advice would be appreciated.
Thanks,
Richard