Advanced Scenarios for LightSwitch

| by Jonathan Allen Follow 396 Followers on Sep 13, 2010. Estimated reading time: 2 minutes |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

LightSwitch brings together a number of technologies including Silverlight, Managed Extensibility Framework, and WCF RIA Services. If LightSwitch becomes popular, developers who understand these technologies will have a significant advantage over those who simply wire forms together using the design surfaces.

LightSwitch, Microsoft’s answer to lightweight CRUD style applications, has recently been released in two parts. The first is the LightSwitch Beta 1, which is matched with a Training Kit. We have already reported on the core functionality, which is the ability to quickly create simple business applications using variety of backend technologies. Today’s piece looks at some of the advanced features.

The first scenario covered by the Training Kit is building a custom control. When doing normal programming with WPF or Silverlight, creating custom controls is more or less just something to do if you happen to need one. With LightSwitch they take on much more significance. In effect you have two classes of developers, those who simply wire together controls and those who define them.

Control creation for LightSwitch isn’t exactly easy with 5 projects needed for a new control. First there is the control itself, the “Client” project, which is coded in Silverlight. This is paired a “Common” project, also in Silverlight, that has meta-data about the control. Next up is the “Designer” project, which is used by the LightSwitch design surfaces inside Visual Studio. Since this code is run directly by Visual Studio it must be in CLR 4. Part of the reason for these projects is that you need to hook into extension points exposed via the Managed Extensibility Framework.

Once all of the code is done you still need to package the control. There are two packaging projects, one is specific to LightSwitch while the other is a normal VSIX project. If you don’t recall, that is the package format for any Visual Studio extension. To test your control library you must install the VSIX package, at which point you can start using the new control in your LightSwitch application.

The second “advanced” scenario really shouldn’t be. LightSwitch accesses non-SQL based data sources via WCF RIA Services. These are built like normal RIA services, optionally with the client access part turned off so that only LightSwitch applications can access it. The normal RIA operations such as initialize, submit, query, insert, update, and delete will be needed. While building RIA services are strangely more difficult than they seem like they should be, at least there are no VSIX packages to worry about.

A warning: the training kit does not install itself in the normal places such as Program Files or the Start menu. So if you can’t find it later look for folder called “LightSwitchTK”. On my test machine this was installed under the root directory.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

greate news by tou cao

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you