views:

15

answers:

1

Hi

I have a gridview which will have Insert/Delete/Update. There are two kinds of exception which i am concerning right now is Concurrency and Unique Constraint

Right now i can capture the exceptions by using

  private void OnSubmitChangesCompleted(SubmitOperation so)
    {
        if (so.HasError)
        {

            //RadWindow.Alert("Modification is failed because of concurrency issue."+ "\nPlease close the window and reopen it", OnClosed);
            //so.MarkErrorAsHandled();
            MessageBox.Show(string.Format("Submit Failed: {0}", so.Error.Message));
            so.MarkErrorAsHandled();
        }

    }

However, the Message is too unfriendly . And don't clarify whether it is Concurrency exception or Unique constraint exception.

can someone tell me how i can clarify them?I try to use the GetType() to see what kind of exception they have but i both get the exception of DomainOperationException.

Note: for the case of Update , it should be able to capture either Concurrency Exception or Unique constraint exception. For Delete, I think only Concurrency Exception can be thrown. For Insert, only Unique constraint exception can be thrown.

Any help would be appreciated.

I found a similar situation in my case at

http://forums.silverlight.net/forums/t/198896.aspx

but i don't really know how to check something similar as

BananaCannotBeDeleted() in that example because i need to check the Unique or Concurrency which involve the database in my case.

A: 

You may need to catch the specific exception server side and throw with you specific message.

For example, catch ConcurrencyException and UniqueConstraintException then throw with your own exception and message.

jeffo