Click to add

Click to add
ex: [email protected]

Click to add
What would you like to tell me?

 

  • Home
  • Blog
  • Portfolio
  • Articles
  • Downloads
  • Contact

This is how I blog...

  • Home/
  • Blog/
  • Using Webservices with Telerik OpenAccess

Using Webservices with Telerik OpenAccess

One of the major issues with querying a webservice with the non-domain model approach to OpenAccess was that if you tried to return a list of objects directly you can't dispose of your scope!  Ack!

What happens client side is that you get a callback error saying "The ObjectScope is already closed"...bummer I wanted those objects

I had a bunch of tickets go back and forth with the OpenAccess guys at Telerik and they suggested using fetch plans.  I however do not want to setup 40 fetch plans :)

So lets use anon typed in-memory objects...they seem to return fine while allowing me to kill my scope.

So from this:

List<ViewAllRequest> returndata = (from r in scope.Extent<ViewAllRequest>()
                                   select r).ToList();

To this:

var returndata = (from r in requests
                  select new {
                      RequestID = r.RequestID,
                      Status = r.Status,
                      ResidentName = r.ResidentName,
                      ResidentEmail = r.ResidentEmail,
                  }).ToList();

So really we're just re-creating the objects, but you can now dispose of your scope before you return from the webservice with no errors!

Cheers,
Steve

One of the major issues with querying a webservice with the non-domain model approach to OpenAccess was that if you tried to return a list of objects directly you can't dispose of your scope
tutorial
openaccess , webservices
  • LinkedIn
Back to all posts
March 15, 2012   /  
Visit Steve on Google+
comments powered by Disqus

Search

Blog Categories

  • fixes
  • news
  • other
  • previews
  • rants
  • reviews
  • tutorial

Recent Comments

Tags

3x404243444x5253AjaxAnalyticsAsp.netBetablog-postboolChoiceFieldCommunityContentViewContextContractControlscssCTPCufonDatabaseDelaysDesignDetailDisqusdowntimeDropboxdynamicDynamicContenteCommerceELMAHEnergy-MarketersEntendingErrorEventsExtensionFieldControlFixFlatTaxonFieldFontsFormsGeneric-ContentGoogleHierarchicalTaxonFieldhostingHtmlimageImagesjavascriptJobjQueryJustJustCodeJustDecompileJustTraceKendoUILayoutControlsLogMarketersMasterMindscapeMinificationModule-Buildernew-productsNotesOpenAccessOptomizationPage-EditPerformancePITSportfolioPreviewPrimerRackspaceRadChartRadControlsRadEditorRadNotificationRadStyleSheetManagerRadXmlHttpPanelreleaseReportingResolutionReviewroadmapRoutingScamScrewedSDKSearchSelectorsServicessitefinitySkinsSpeedSQLStored-ProcedureStored-ProceduresteleriktellarickTemplatesthemeToolsUpdateuptimeVersionsViewstateWCFwebinarWebservicesWF4XmlHttpPanelYSOD
FreshBooks

Latest Blog Posts

  • The Sitefinity ContentView can be an ass#$%@ sometimes
    The problem with the assumtions Sitefinity ContentView makes
  • Fixing Ugly Hierarchical DynamicContent Urls
    Sitefinitys default Hierarchical DynamicContent control has no Url flexability...here's how we can fix all that so we have nicer routing.

Recent Twitter

Recent Comments

Address

Hamilton, ON
Canada
Site: http://www.sitefinitysteve.com
Email: contact
Buy me a beer

Disclaimer

Important: This site is perhaps too awesome for some users.  Please self govern your own awesomeness before browsing the awesome content.  
Telerik MVP Logo

Back to Top