Download the Visual Studio LightSwitchBeta2 here
This post explains the steps to create a sample Visual Studio LightSwitch application in VS 2010
1. Open the Visual Studio 2010, File->New->Project. Select the project template from the dialogue, You can choose either VB or C# for application development
2. You will be presented with two options to use the data for your application, either Create a table or use existing data sources
3. Here I am showing the Create new table option, click on this option then you will land in entity designer where you do the most of your application development
While selecting the data types to table columns, you will notice several business domain types like email address, phone number and money. You are not required to write any validation logic and required filed validators when select these types
4. Now Create a screen based on the columns which you added in the above step
There are different screen templates which allow you to create the screens. Here I am adding two screens here, one for saving the data and another for searching the data
Add screen Template which you can use to add the data to Employee table
Search Screen Template which you can use to search the data
That’s it!! Now you can hit F5 to see the working application
The search screen looks as below
Using the links in left hand task menu you can create a new employee record and can search the existing records. Each action which you add opens as a tab and stays in the application
Light switch gives the validation errors automatically without writing any code or regular expressions. Here in this case if you enter invalid email then it prompts as shown below
when you open the Search Employee screen you will be presented the results with grid in screen and pager as well. No need write any code for paging!
Customization makes easier!!! Typically while application is in running mode you can not make any changes to the UI but in LightSwitch you can customize your screen by changing positions of the fields or even adding new columns dynamically to the screen with few clicks…..
Office Integration – You can export the results to excel with a click as shown below
Now the data source is sql server but you can even connect to SharePoint and other external data source and can easily integrate with them.
Deploying the application
By default LightSwitch outputs the application as desktop exe but if you want to view the same application in browser with no effort just change application properties as shown below
|Share this post :|