Silverlight Reporting Overview
- 3 minutes to read
This document explains the main concepts for using XtraReports in Silverlight applications.
Reports are created on the server, and the client gets only the result - a report document is shown in a Print Preview and is ready to print and/or export.
This means that on the client, you have no access to the XtraReport class. Documents are created on server, and can be printed and/or exported from the client side.
The client-server interaction is carried out through a WCF service maintained by the ReportService class.
If you need to inherit from the Report Service, your class should have the following attribute.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
Report Service Hosting
The Report Service is a WCF service, and a typical way to deploy it is to host it in a Web application.
To do this, you can use the wizard available in the Add New Item dialog of the Visual Studio.
After you create a DevExpress v14.2 Report Service, the wizard will add an .svc file to the project and register all necessary configurations in the web.config file.
If your Silverlight application is hosted on a Web site and uses reports, we recommend that you move the reports to a separate assembly.
Report Service Configuration
To store temporary data (generated documents, files ready for export and so on), the report service uses a cache, which may be located in memory or in a database. By default, a Microsoft SQL Server database is used, but you can use any database to which it is possible to connect using XPO. To view the full list of the supported database formats, refer to the Database Systems Supported by XPO topic.
By default a report service stores its cache in a database specified by the connection string named xpf.printing:
<connectionStrings> <add name="xpf.printing" connectionString="xpoprovider=MSSqlServer; data source=(localdb)\v11.0; attachdbfilename=|DataDirectory|\ReportService.mdf; integrated security=True;connect timeout=120" /> </connectionStrings>
If no connection string is specified, the cache is stored in memory. To learn how to use data sources of other types, see the following article online: How to create a correct connection string for XPO providers.
The name of a connection string used to access the cache may be changed by specifying the documentStore.connectionStringName parameter in the Web.config file, or by implementing the IDocumentDataStorageProvider MEF extension (for more information, see Extend a Report Service with Custom Functionality).
It is strongly advised that you use a separate database instance for storing the report service cache. This allows you to safely delete the cache, which may be required for migrating between different versions of DevExpress controls.
Additional parameters are set in the xpf.printing configuration section (e.g., the life-cycle of the database entities in milliseconds that is defined by the keepInterval parameter).
<devExpress> <xpf.printing> <documentStore keepInterval="1200000" connectionStringName="xpf.printing" /> </xpf.printing> </devExpress>
The server automatically creates the database scheme when the first connection is set up.