LightSwitch Reporting Preview

DevExpress Data Blog
13 June 2011

With our recent 11.1 release we have added support for Microsoft’s brand new development platform: Visual Studio LightSwitch. LightSwitch enables developers to quickly create business applications using preconfigured screens that adapt to the data you create. Unlike the Access databases of yore, the projects LightSwitch creates are written in .NET and adhere to standard practices when developing Silverlight applications. Additionally, LightSwitch allows for customer extensibility.

Here is where we come in.

DevExpress has partnered with Microsoft to bring you our award winning reporting solution within the context of LightSwitch. I will give you a quick tour using a pre-configured LightSwitch project. A little warning though: LightSwitch is still in Beta! Because of this little detail, our reporting extension will also be in beta up until there is an actual release of the LightSwtch platform. What I am showing here is indeed subject to change.

The screenshots posted here use the Course Manager application available over at MSDN.

The Extension

The first (and important step) is activating the extension. This is done by navigating over to the project properties and checking the appropriate extension.

LightSwitch Reporting Extensions

The Service

LightSwitch is actually creating a Silverlight application. Those familiar with our reporting suite know that in order to have a correctly functioning Silverlight report viewer one must add our Report Service. This is also the case for LightSwitch:

LightSwitch Report Service Data Source

The procedure to get this up and loaded is to add a new Data Source (by selecting a WCF RIA Service) and choosing the XtraReportService option.

LightSwitch Report Service

The Report

Once these two things are set up, its time to actually build the report! This is done by switching from Logical View over to File View

Is this the fifty?

and adding a new XtraReport to the Server project.

Adding the Report

Adding the Report

Once there, the first thing to do is to select the data to which the report will be bound.

LightSwitch Data Source

We have a special LightSwitchDataSource which allows the direct querying of the entities you define within LighSwitch. We never intended this implementation to be a hack of sorts that relied on extraneous data sources. We felt that a native LightSwitch experience that allowed the querying of in-project entities would provide the maximum benefit.

The nice thing about the entities designed within LightSwitch is that they also support the notion of master-detail type reports. Here is a screenshot of a report design in action:

LightSwitch Report Designer

This particular report is bound to the LightSwitch Student entity. As you can see, the enrollments link is preserved in order to allow for a master-detail type report.

The Code

One of the benefits of using LightSwitch is their notion of Screens. When editing Screens in LightSwitch the user has access to the Visual Tree. It is there that one can add buttons to trigger events. Once the button is added, the Execute Code can be edited. We have created a special method to render your reports once designed. Take a look:

LightSwitch Code

How simple is that!

The Result

Here is what the report looks like when everything is done:

Report Preview

Summary

Hopefully this little tour has answered some of your questions. I would like to reiterate, however, that this is still in beta. There are still a number of details that we need to polish up. The first question you might have is “how much will it cost?” A great question! This is one of those details we are still working out. Stay tuned for more information!

If you have any LightSwitch related questions, a great resource can be found over at MSDN: http://msdn.com/LightSwitch. There you can find tons of downloads, samples, and training materials.

As always, if there are any comments and/or questions, feel free to get a hold of me!

Seth Juarez
Email: sethj@devexpress.com
Twitter: @SethJuarez

Want The Best Reporting Tool Ever?

Get The No-Compromise Reporting Tool for WinForms, ASP.NET, Silverlight and WPF! - Native integration with DevExpress WinForms and ASP.NET Controls, unequalled design-time productivity, industrial-grade features. Try a fully-functional version of DXperience for free now: http://www.devexpress.com/Downloads/NET/

Let us know what you think of our Reporting Suite by rating it in the VS Gallery!

Follow SethJuarez on Twitter

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.