Last post Nov 01, 2009 01:05 AM by mcm
Oct 10, 2009 09:59 PM|mcm|LINK
With EntityDataSource is there a way to get the original exception? Basically I want to handle my own validation exceptions but let other exceptions through. It seems that the Exception property on the EntityDataSourceChangingEventArgs object is a new Exception
with the message set to the original exception's message prefixed with "Error while setting property 'PropName': " and InnerException is null, so I'm unable to differentiate based on exception type. Currently I'm adding something to the beginning of the message
for all my validation exceptions in order to identity them, then having to remove the "Error while setting property 'PropName': " prefix as well as my own before displaying it to the end user, but is there a better way of going about this?
Oct 13, 2009 08:05 AM|Wencui Qian - MSFT|LINK
If there's no answer here, I suggest you to try asking Linq To Entities questions here too:
Oct 14, 2009 06:40 AM|mcm|LINK
Thanks, I gather though they more deal with WinForms:
Nov 01, 2009 01:05 AM|mcm|LINK
Looks like this dilemma is now sorted with ASP.NET 4 as it now no longer replaces the original exception with it's own, it now offers up the original exception instead.
What would be nice is for all the values to be tried and for EntityDataSourceChangingEventArgs to offer up a collection of all the validation errors like it does in Linq to SQL instead of just the first but at least differiantating on exception type is now