Introduction:
In this article, we are going to see how to Handle Data that is part of designing the Visual Studio Light Switch Application. In our previous article, we have seen how to design a table with a relationship normalized in order to have Relational Data structure in place. Handling Data in Visual Studio Light Switch Application is very critical as based on the data and design the front end UI screens are automatically created. We are restricted to do a code at the maximum in order to take advantage of the Visual Studio Light Switch Framework. Let us see the steps and in detail analysis on how to handle the data easily by creating a new Visual Studio Light Switch Application.
Steps:
Open Visual Studio 2012 IDE in an administrator mode and Create a new Visual Studio Light Switch Project or select the existing Light Switch project which we created in Part 4 of this series as shown in the screen below:

In Visual Studio Light Switch Application, we have option to “Create a new Table” and create your own data or the other option is to “Attach to External Data Source” as shown in the screen below:

So here, we can see a Generic Option of “Attach to External Data Source”, so what data sources we can create? With Visual Studio Light Switch Application we can connect to below data sources of our choice,
- To SQL Server Database
- To SharePoint List
- To OData Service
- To WCF RIA Service
Let us take an example of how we can connect to an ODATA Service and accomplish the data interaction with the screen in this tutorial. Northwind provides a free OData service to access the data, which can be accessed using the URL http://services.odata.org/Northwind/Northwind.svc/. Let us use this service and access the data that we will use it in the application, which we are going to develop. Type the URL in the browser and we can see the data as shown in the screen below:

To start with, Right Click on the Data Source folder in the solution explorer and select Add New Data Source. A wizard opens as shown in the screen below:

Select the ODATA Service data source from the list available and Click on the Next button to proceed further to the next step as shown in the screen below:

Now specify the ODATA Service URL (Northwind database URL - http://services.odata.org/Northwind/Northwind.svc/) and click on Next button as shown in the screen below. If the service needs any authentication procedure, provide the necessary details and click on the Next button.

Next step is to select the Entities that is been listed, here we have a single Entity. Click on the entity checkbox and specify a new datasource name as shown in the screen below:

Now click on Finish button and we can see the list of tables and the columns that are available for each of the tables as shown in the screen below:

Now the process is the same as we discussed in our earlier article. Just add a new screen from the list of available templates as per the requirement and select the appropriate table to get the data feed and uses it accordingly as shown in the screen below.

Conclusion:
Therefore, in this article we have seen how to handle data in Visual Studio Light Switch application by connecting to external datasource available services and design the application with the data.