DevForce Resource Center » Samples » Additional code samples » POCOs » Code sample: POCOs (Silverlight)

Code sample: POCOs (Silverlight)

Last modified on September 20, 2012 10:40

This sample application shows how to query for POCO objects in your DevForce application.  It will define the POCO class, add a service provider, and extend the EntityManager to make client-side querying easier.


You need to retrieve data from a non-relational data source, such as XML.


Using DevForce POCO support you can work with POCO objects in the same way you work with DevForce database-backed entities.  This sample shows how to provide query capabilities to your application.  

In the sample we'll define a POCO class named "State" whose data source is an XML file containing information on US states.  The Silverlight application will issue an asynchronous LINQ query for these objects, just as it would for other DevForce entities. This is possible because we've added an extension method to the EntityManager which allows for easier querying.  On the server, we've implemented a service provider to fulfill the actual query request.  

On the client, our application loads the data for the lower 49 states by making this simple query:

  var states = await _mgr.ExecuteQueryAsync<State>(_mgr.States().Where(s => s.Lower49));
 Dim states = Await _mgr.ExecuteQueryAsync(Of State)(_mgr.States.Where(Function(s) _

Created by DevForce on January 10, 2011 12:57

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2020 IdeaBlade