WCF RIA Services
- 3 minutes to read
Microsoft WCF RIA Services simplifies the development of Rich Internet Applications (RIA), such as Silverlight applications, by offering framework components, tools and services that provide a comfortable mechanism for data handling. The application logic is stored on the server and RIA Services client applications have access to this logic.
#Instant Feedback UI Mode
The RiaInstantFeedbackDataSource class is a component that can be used as a read-only data source for the GridControl in Instant Feedback UI Mode.
RiaInstantFeedbackDataSource processes in-memory data in Instant Feedback UI Mode. To improve performance and maintain the grid's accessibility for user actions, regardless of data operations initiated against the grid, all data-intensive tasks (sorting, grouping, etc.) are run asynchronously in a single separate thread.
To learn more, see Instant Feedback Mode
#Extended Data Query Feature
WCF RIA Services uses the EntityQuery class to represent a query method invocation. This class provides only a few query operators: Where, OrderBy, ThenBy, Skip, Take. A palette of methods that is this small imposes certain restrictions on possible operations with data. Extending the data representing functionality by means of these operators is possible, but results in invoking a lot of queries to execute an operation. This causes a loss of performance.
The RIA Services Extended Data feature allows you to avoid this by developing additional methods that provide the DXGrid with all necessary information to group, filter, summarize data, etc. So, a number of queries for an operation can be reduced from many to one. To do this, for each method that returns data entities, create an additional method with the same name plus the “ExtendedData” postfix. This additional method invokes the DevExpress.Xpf.Core.ServerMode.ExtendedDataHelper.GetExtendedData method that returns all necessary information. To use additional methods, set the RiaInstantFeedbackDataSource.UseExtendedDataQuery property to true.
For example, there are two methods that return entities of the Product datasource. The GetOrders method returns all Order entities. The GetOrdersByCustomer method returns entities that satisfy the specified condition. The following example shows how to extend these methods:
public IQueryable<Product> GetOrders() {
return this.ObjectContext.Order; }
public IQueryable<Product> GetOrdersByCustomer(string customerName) {
if(String.IsNullOrEmpty(customerName)) return GetOrders(); return this.ObjectContext.Order.Where(customer => customer.Name == customerName); }
public string GetOrdersExtendedData(string serializedParameters) {
return DevExpress.Xpf.Core.ServerMode.ExtendedDataHelper.GetExtendedData(GetOrders(),serializedParameters); }
public string GetOrdersByCustomerExtendedData(string customerName, string serializedParameters) {
return DevExpress.Xpf.Core.ServerMode.ExtendedDataHelper.GetExtendedData(GetOrdersByCustomer(customerName),serializedParameters); }
The DevExpress.Xpf.Core.ServerMode.ExtendedDataHelper.GetExtendedData method takes an original query method and SQL parameters serialized into a string via the serializedParameters property as the arguments and returns encoded information about all elements to be displayed on the GridControl. Invocation of original methods sends this information to the client's application in one piece.
The example below shows how to use ExtendedDataQuery with RIA Services.