Off and on I've been searching through the forums to discover the best way to handle this. I have two custom stored procedures: one to insert a record and one to delete a record. They're custom procedures as they don't fit an entity structure because they need to check on a related table a couple tables up the line - not worth deep loading - and have some custom logic requirements.
I am utilizing EAB error handling, and have it set not to rethrow errors. As the rest of the application is designed around this, I'd prefer not to have to change this in order to accomodate this small aspect of the application. My problem is that inserts and delete custom stored procedures are always void. Even if there is an error thrown, it's caught by EAB and there's no way of knowing at the UI level the transaction's success.
For my Insert one, I did a dummy entity creation:
if user_name() is null
BEGIN
SELECT FolderId, ImageId FROM FoldersImages WHERE 1=0
RETURN
END
And then after all the logic takes place, I do a select to return a T<List> of the new record and check on the count. If < 0 I've got a problem and I can act accordingly (count will only ever be 1 as it's a junction table that doesn't allow for duplicate values). However this is extremely crufty - there must be a better way! Optimally there would be a boolean success sent back up the line, but I know that this is not supported. I have the same problem with the delete proc.
Does anyone have any suggestions? Or is the above the best way to reliably tell if there's an error or not? Or should I rethrow all errors already caught by the EAB, and catch them again?
Much thanks,
Ted