How to trap failed Save using LLBLGenProDataSource2?

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 28-Mar-2009 03:00:52   

I'd like to try using an LLBLGenProDataSource2 instead of coding my persistence logic. However, I see from the documentation that the EntityUpdated (and EntityDeleted, EntityInserted) events are only raised if the update (or deletion, insertion) was successful.

How do I trap the case when update failed so that I can display a message to the user?

I'm used to objectdatasource's updated events which pass in the return value of the update method in the event args. LLBLGenProDataSource2 doesn't seem to have same thing.

Any tips other than making LivePersistence = false and writing my own code to persist entities? I really want to try a declarative-only solution for efficiency of writing new apps.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 28-Mar-2009 11:35:14   

The general approach is that the bound control (e.g. a grid) will raise an event that an exception occured. The datasource itself simply bubbles up any exception occuring during saves/deletes so they always end up in the grid or other control which triggered the call on the datasource in the first place (as datasourcecontrols don't act by themselves). Does your control (e.g. the grid) offer an event which is raised when an exception occurs?

Frans Bouma | Lead developer LLBLGen Pro