Client applications such as Silverlight / WPF application commonly retrieve and store that in a relational database server such as SQL Server. One of the common challenges in developing an n-tier RIA solution is to streamline the application logic between the middle tier and the presentation tier. This generally means that you may want to maintain only one set of application's logic that you can share in both the server and client. To address this challenge, a RIA solution requires a data service component that automatically persists the server-tier entities and make them accessible in the middle and presentation tier.
This topic provides a comprehensive overview of building data-aware applications with ClientUI, and describes the supported data services as well as the best practice in handling client-server data operation.
The data service component such as WCF RIA Services addresses the client development challenges by providing framework components, tools, and services that enable the application logic on the server to be available in the client without requiring you to manually duplicate the server's data entities and logic.
The following sections describe the supported components for building data-aware applications with ClientUI.
Microsoft WCF RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.
|WCF RIA Services is available as free download from Microsoft website, please refer to the links below. Also note that WCF RIA Services does not support Windows Presentation Foundation (WPF) development since it is designed exclusively for the Silverlight platform.|
Similar to Microsoft's WCF RIA, DevForce from IdeaBlade also provides a comprehensive framework for building and operating Rich Internet Applications (RIA) solutions. DevForce provides the tools, techniques, and advanced features to build powerful RIAs fast. On top of that, DevForce is specifically designed to take advantage of client-driven development with MVVM pattern support. With full MVVM support in Intersoft ClientUI controls as well, and combined with DevForce's powerful data services; both tools allow developers to leverage the best practice in design and architecture for building rich and modular cross-platform applications.
Starting from Intersoft ClientUI 5 release (part of WebUI Studio 2011), DevForce Universal Express will be now readily available in your development machine as you installed WebUI Studio. This allows you to quickly build next-generation RIA solutions that leverage the richness of Intersoft's presentation controls and the advanced features of IdeaBlade's data services.
|IdeaBlade DevForce is a commercial data service component which you need to license separately. If you do not currently have a DevForce license, a trial license will be automatically installed which permits you to use the product with the restriction of 10 (ten) tables in a single application. For more information on DevForce and ClientUI license bundling, please visit WebUI Studio and DevForce web page.|
To learn more about DevForce from IdeaBlade, please see the following resources.
Intersoft ClientUI provides tools, templates, and libraries to simplify data-aware application development in an end-to-end approach using MVVM architectural pattern – from the presentation layer development to the backend layer – by leveraging the capability and features of the data services mentioned above.
To learn more how to implement server data access using MVVM pattern, see QueryDescriptor Overview.
One of the biggest challenges while building data-aware applications is to deal with various data operation such as sorting, filtering and grouping – which are required for users to work with information in efficient and intuitive manner.
The basic Silverlight data controls such as DataGrid and DataPager already support common data operation such as sorting and paging. However, the data operation is processed in the client-side, which means that the sorting and paging operation are only applied to the provided data source in the client-side. For the data to be processed and viewed correctly, you are required to provide all data to the DataGrid and DataPager controls. This technique, which is well known as client-side data operation, could lead to serious performance bottleneck especially when the dataset is relatively large in size. The ideal approach to address this challenge is by retrieving the data in small chunks at a time, which is also known as server data operation. Unfortunately, the basic Silverlight data controls and many similar data controls in the market have not been designed to support server data operation.
Intersoft's ClientUI data controls were designed to fully support both client and server data operation which are discussed in the following points.
All data operation such as filtering, sorting and paging are executed entirely in the client-side against the underlying data source available in the client. You are required to provide the complete datasource in order for the data controls to handle the data operation. This mode is ideal for working with small and medium dataset.
The following illustration describes how the client data operation works.
All data operation such as filtering, sorting and page are executed in the server-side. This means that the data controls such as data grid should not perform any actions by its own. In addition, the data controls should provide the query details in a way that enables developers to consistently capture, process and execute the query in the server, and finally return the shaped dataset back to the client-side.
Intersoft ClientUI provides a powerful data framework and a wide range of data controls designed to fully support server data operation such as illustrated in the following figure.
As shown in the above illustration, Intersoft ClientUI Data Framework provides libraries that span across different layers such as the UI controls (View), data component model, and data providers. These libraries are created to help developers build rich client applications that are scalable, extensible and compliance with the best practice in design and architecture such as MVVM pattern.
The following sections discuss each component of the ClientUI Data Framework in more details.
ClientUI includes three essential controls to work with data with full support for both client and server data operation.
These controls support both data operation that can be set through the provided QueryOperation property. When the QueryOperation is set to Server, each data control will store the current query operation in their own respective QueryDescriptor property such as FilterDescriptors, SortDescriptors and PageDescriptor.
The following table shows where the query is stored in each ClientUI data control.
The data controls are available in the Intersoft.Client.UI.Data assembly.
In addition to the data view controls, ClientUI also ships with a set of data components that serve as the framework for building MVVM data applications. At the heart of the data framework are the PagedCollectionView and QueryDescriptor components, which are specifically designed to facilitate application development that emphasizes on loosely-coupled architectural design such as in Model-View-ViewModel (MVVM) pattern.
In essence, the data components streamline the data flow between the View, ViewModel and Model enabling each layer to interact consistently and seamlessly without requiring a specific knowledge about each other. For instances, a data grid can display, sort, page and edit data regardless of the data service type.
For more information about QueryDescriptor, the key concepts and features, please see QueryDescriptor Overview.
In the earlier section, you have learned that building data-aware client applications require data service as the mediator between the presentation and the backend layer. Two of the most popular data services are WCF RIA Services and DevForce, which you can evaluate and choose based on your application's complexity and requirements.
Regardless of which data service suits your application best, Intersoft ClientUI provides full support for both tools through a set of data providers. The data providers facilitate a generic set of object model and APIs which unify the differences of both tools into streamlined interfaces that are architecturally solid, consistent and developer-friendly.
Intersoft ClientUI ships with two data providers listed below.
With the data components and data providers combined, you can easily build dynamic data views that support rich data operation such as sorting, paging, filtering and grouping. This architecture design also allows easy data service switching without affecting the existing Views and ViewModels – thanks to the unified interfaces and APIs. Furthermore, it allows greater extensibility as more data providers are available and supported in the future.