Hi,
I've got a simple Silverlight 2.0 app set up and talking with an webservice
using ado.net entity datamodel. In the webservice I have a
ChangeIntercept or declared like this:
<ChangeIntercep tor("CodePropAt tributeTypes")_
Public Sub OnChangeCategor ies(ByVal p As
myEntities.Code PropAttributeTy pes, ByVal action As UpdateOperation s)
If action = UpdateOperation s.Add Then
Throw New DataServiceExce ption(400, "Test Insert Error")
ElseIf action = UpdateOperation s.Change Then
Throw New DataServiceExce ption(400, "Test Update Error")
End If
End Sub
I've set breakpoints and I can step thru the code and see that the code is
being run properly. The problem is I have no idea how to handle this
exception on the Silverlight client. My async callbacklooks like this:
Private Sub subChangesCompl ete(ByVal ar As System.IAsyncRe sult)
Try
_entityProxy.En dSaveChanges(ar )
'datagrid is not in edit mode anymore
_blnInEdit = False
System.Windows. Browser.HtmlPag e.Window.Alert( "Changes Saved")
Catch ex As Exception
System.Windows. Browser.HtmlPag e.Window.Alert( ex.Message &
ControlChars.Ne wLine & ex.InnerExcepti on.Message)
End Try
End Sub
The IAsyncResult does not seem to contain any exception indications so I'm
curious as to how the exception should make itself known to the client.
Thanks
I've got a simple Silverlight 2.0 app set up and talking with an webservice
using ado.net entity datamodel. In the webservice I have a
ChangeIntercept or declared like this:
<ChangeIntercep tor("CodePropAt tributeTypes")_
Public Sub OnChangeCategor ies(ByVal p As
myEntities.Code PropAttributeTy pes, ByVal action As UpdateOperation s)
If action = UpdateOperation s.Add Then
Throw New DataServiceExce ption(400, "Test Insert Error")
ElseIf action = UpdateOperation s.Change Then
Throw New DataServiceExce ption(400, "Test Update Error")
End If
End Sub
I've set breakpoints and I can step thru the code and see that the code is
being run properly. The problem is I have no idea how to handle this
exception on the Silverlight client. My async callbacklooks like this:
Private Sub subChangesCompl ete(ByVal ar As System.IAsyncRe sult)
Try
_entityProxy.En dSaveChanges(ar )
'datagrid is not in edit mode anymore
_blnInEdit = False
System.Windows. Browser.HtmlPag e.Window.Alert( "Changes Saved")
Catch ex As Exception
System.Windows. Browser.HtmlPag e.Window.Alert( ex.Message &
ControlChars.Ne wLine & ex.InnerExcepti on.Message)
End Try
End Sub
The IAsyncResult does not seem to contain any exception indications so I'm
curious as to how the exception should make itself known to the client.
Thanks