Learn more about Microsoft Visual Studio LightSwitch as we count down the 7 best features in this new Microsoft offering.
Microsoft introduced LightSwitch applications very recently. It is integrated with Microsoft Visual Studio which can be a standalone on Visual Studio 2010 or could accommodate itself as a part of the normal Microsoft Visual Studio 2010 IDE. The LightSwitch applications are introduced for creating a line of business applications which are more data-centric.
Most data-centric business applications perform the same basic CRUD (Create, Read, Update and Delete) operations. In such applications what the developer would do again and again is writing the same kind of code and developing a similar kind of UI.
Microsoft Visual Studio LightSwitch
revolves around selecting the type of screen and defining the data for the screen. Below are the list of ready made screen types that Lightswitch provides.
- New Data Screen
- Search Data Screen
- Details Screen
- Editable Grid Screen
- List and Details Screen
The Lightswitch application eases the job of the developer by asking him to define a data source with a well defined schema and simply add the appropriate screen for it. Maybe a little customization and business logic should be written if required.
Microsoft Visual Studio LightSwitch can be downloaded from here. Note that only the Beta version of Visual Studio Lightswitch is released.
Fast Paced Development of Data-centric Applications
When using LightSwitch the development time is reduced as the developer doesn't have to spend much time on the UI and data access since the data screens are readily available and it can do the data access on its own. If any customization is required only then does the developer needs to intervene. This ensures a couple of things:
- The data-centric business applications are developed fast and in a stable manner.
- The final product gets into the user's hand in no time.
For example here are the steps for creating a sample working screen.
- Create the table to store data and define the schema for it.
- Select Add New Screen and select the required screen as shown in Fig 1.0
- Run the application, you are done with add new or search module based on the screen you have selected.
By considering the above information you can understand how fast a data-centric application can be developed using LightSwitch.
Easy to Choose Whether the Application is to be Browser Based or Desktop Application
This is really an astonishing fact. Declaration of your application to run on a desktop environment or on a web browser is just a click away. Believe me this declaration shouldn't need to be done before starting off with the project but can be done during the course of development or even if the development is complete. All you need to do is go to the properties of the project and choose the application type that's it you are done. Check Fig 2.0
Fig 2.1 shows the sample application selected to run as a desktop client
Fig 2.2 shows the sample application opted to be run in a web browser
Support for Multiple Data Sources
Apart from the basic data source such as a normal database you could use the following data sources in the LightSwitch applications that you develop.
- WCF RIA services
- External Databases
- SQL Azure
Fig 3.0 shows the screen shot for adding Other Datasources.
Data Integrity and Validation is Straightforward
While you create the data table you would notice that there are business domain data types like EmailAddress, Money and PhoneNumber. These business domain data types increase the data integrity in the application as these fields would expect only data in specific formats like <emailid>@<domain>.com.
Another wonderful thing about the Lightswitch application is the data validation. The validation is performed on the screen based on the type of the underlying data and appropriate message is displayed as shown in Fig 4.0.
It doesn't stop there, in case the developer likes to provide a custom validation for a particular type then he can click the
CustomValidation link available on the property window of that column. Fig 4.1 shows the screen shot of it.
Application Customization - On the Fly
Like the classic .NET applications in order to customize the UI the developer doesn't have to stop the application from running. There is an option available on the output screen saying "Customize Screen" as shown in Fig 5.0, simply click on it and do the required customization on the screen.
Note: This option will only be available when the application is run in debug mode. So when the application is given to the user in release mode this option will not show up.
Built On Top of .NET Framework
The best part of all is the entire Lightswitch application is built on top of .NET framework. As the name indicates the UI of the application is generated using Silverlight and the data retrieval is achieved using WCF RIA services. This gives developers the provision to perform custom implementations in C# Programming or Visual Basic using the .NET framework as required by the business.
Application Security - Authentication
Visual Studio Lightswitch application supports the below mentioned authentication modes.
Go to the project properties and select Access Control. You will find the options to select the type of authentication required as shown in Fig 6.0.
The developer would be able to add the users if the "Granted for debug" option is selected as shown in Fig 6.0. Fig 6.1 shows the sample built-in add user screen.
I hope this article provided a good overview of Microsoft Visual Studio LightSwitch, its capability and the top 7 features. Most developers should be able to develop a decent data-centric application using LightSwitch pretty quickly. If you have any conflicts or comments then please make use of the comments section.