This is a migrated thread and some comments may be shown as answers.

Handling Errors in OData Silverlight

2 Answers 52 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brent
Top achievements
Rank 2
Brent asked on 28 Aug 2012, 02:48 PM
Hello,
 I'm converting my project over to silverlight 5 with OData 3.  Do you have any examples of how to handle errors being returned by the context via the WCF service.  I see you have an example in your documentation for WCF Ria but not Odata.  I'm probably missing something but I am trying to capture the error in a try catch block in the lambda being submitted on the background thread but I am not getting any specifics about the error.

           

Dim myData As AspireWebWcfDataService.MyContext = ContextFactory.ObtainContext
Dim newApp As New AspireWebWcfDataService.Application
With newApp
    .ApplicationType = myNewWindow.NewProjectType
    '.ID = Guid.NewGuid
    .ProjectName = myNewWindow.NewApplicationName
    .RegionId = myNewWindow.NewRegion
    .IsArchived = False
    .LastUpdDate = Date.UtcNow
 
    'Add Submission Unit
    Dim newSubUnit As New AspireWebWcfDataService.SubmissionUnit
    newSubUnit.StartingPriority = 0
    'newSubUnit.ID = Guid.NewGuid
    newSubUnit.Name = "Original Submission"
    newSubUnit.CreateDate = System.DateTime.UtcNow
    newSubUnit.Type = "original"
    newSubUnit.FilingType = defaultFilingType
    newSubUnit.Status = "ssinprocess"
    newSubUnit.IntegrityCheckAlgorithm = defaultIntegrityType
    newSubUnit.LastUpdDate = Date.UtcNow
    .SubmissionUnits.Add(newSubUnit)
 
    myData.AddObject("Application", newApp)
    'myData.AddRelatedObject(newApp, "SubmissionUnits", newSubUnit)
 
    myData.BeginSaveChanges(Sub(c)
 
                                Try
                                    TryCast(c.AsyncState, AspireWebWcfDataService.MyContext).EndSaveChanges(c)
                                Catch ex As Exception
                                    System.Diagnostics.Debug.WriteLine(ex.Message)
                                End Try
                            End Sub, myData)
 
End With

2 Answers, 1 is accepted

Sort by
0
Brent
Top achievements
Rank 2
answered on 29 Aug 2012, 05:33 PM
I have found by opening the generated ContextService.vb class in the ServerProject and adding the following line of code that the InnerException being returned now shows a more detailed error description
config.UseVerboseErrors = True
0
Viktor Zhivkov
Telerik team
answered on 30 Aug 2012, 12:57 PM
Hi Brent,

Client side implementation for OData Services in Silverlight is provided by Microsoft, not by Telerik OpenAccess.
Silverlight.net official site has great tutorial how to work with OData and Silverlight. You can check it out and post in their or out forums if you have any questions.

All the best,
Viktor Zhivkov
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
Web Services
Asked by
Brent
Top achievements
Rank 2
Answers by
Brent
Top achievements
Rank 2
Viktor Zhivkov
Telerik team
Share this question
or