TechBubbles Microsoft Technology BLOG

Creating a Sample Visual Studio LightSwitch Beta2 Application

 

Microsoft Visual Studio LightSwitch allows the developers to create a high-quality line of business applications with less writing of code. LightSwitch provides the screen templates for common business tasks such as data entry, search , formatting and displaying the data. LightSwitch includes built-in functionality to validate the input with little or no code. We can also write the code either in C# or VB.NET to extend the business logic. image

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

image

2. You will be presented with two options to use the data for your application, either Create a table or use existing data sources

image

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

image

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

image

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

image

Search Screen Template which you can use to search the data

image

That’s it!! Now you can hit F5 to see the working application

image

The search screen looks as below

image

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

image 

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!

image

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…..

image

Office Integration – You can export the results to excel with a click as shown below

image

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.

image

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

image

Share this post :

About the author

Kalyan Bandarupalli

My name is kalyan, I am a software architect and builds the applications using Microsoft .NET technologies. Here I am trying to share what I feel and what I think with whoever comes along wandering to Internet home of mine.I hope that this page and its contents will speak for me and that is the reason I am not going to say anything specially about my self here.

5 Comments

    • Good Question

      The idea is same but it differs in following ways

      1.The UI controls behind LightSwitch are Silverlight where as in Dynamic Data are Web UI controls

      2.The LightSwitch can work with different datasources including SharePoint Lists with out writing any code, but in Dynamic Data you need to write the code using SharePoint SDK to pull the data.

      3.The output type from LightSwitch application can be Desktop or web without writing any code , just a configuration

      4. It is still in beta stage, we need to explore carefully how it scales for enterprise development.

  • I tried ur steps to make a sample application in lightswitch.
    But when i execute this application and tried to save the data, i m getting this error

    “Submit operation failed. The remote server returned an error: NotFound.”

    waiting for ur reply

    Markand Bhatt

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud