best practise for IDataErrorInfo within uow

Posts   
 
    
oki
User
Posts: 27
Joined: 12-Sep-2007
# Posted on: 26-May-2009 12:39:30   

I'm binding LLBLGenObjectDataSource2 to form view with LivePersistence=false.

the PerformWork method passes the e.Uow to my BL. The BL processes each entity2 Elements of Uow and in case of an error the entity2.SetEntityError Method is called. A simple Uow.Commit() throws Exceptions, ok. But cause on affected element has to guess.

How can I inform the UI about this errror? (which Entity2 Element was falty, what kind of error) How can I inform the UI about other error in same way (e.g. ORMQueryExecutionException) which is also handled in BL?

I read the documentation about entity validation and field validation. Also reviewed the validation example for adapter. these use the SetEntityError Method and also thow a ORMEntityValidationException. On UI only Exception.Message is used. Never saw a example for entity2 objects using IDataErrorInfo Interface.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 26-May-2009 21:29:04   

IDataErrorInfo is a standard MS interface,which is why our documentation does not go into a great amount of detail about it.

There are several ways to get the info back about the items which are in error. You could raise an exception with the error item or items as one of the parameters, or by raising a generic fail exception, and then checking the items in the UOW.

Matt