Prologue:In Part I we saw how to connect the external database with a LightSwitch application. In this Part we shall see how to connect a LightSwitch application with a WCF RIA Service as an External Data Source.Preparing the Solution:Fire up the Visual Studio 2010; select LightSwitch from the Installed Project Template.Give the project name as ExternalDSWithLS and click OK to start the application development.Adding External Data Source:Now we will see how to add an external data source for our LightSwitch application. After preparing the solution, you will see the folder like icon with name "Data Source".Right click on the Data Source then select Add Data Source. It will display a wizard as shown below.Selecting Data Source Type:The wizard with those three types of Data Sources mentioned above will be displayed after selecting the Add Data Source option. In this wizard, select the WCF RIA Services Icon which is marked with an eclipse and continue by pressing the Next button.Adding/Selecting RIA Service:In this wizard, you have to select the Add Reference button [No: 1], and browse the directory where the LightSwitchRIAService.Web project is to select the LightSwitchRIAServices.Web.dll file. Select the Service reference [No: 2] to add to the LightSwitch application.Choose the Entity:At last you have to choose the Entity from the Entity Model. To ensure the Entity Model is added with our LightSwitch application as an external data source you will be getting the table structure in the screen as in the picture shown below.Important point to remember:
C# Corner. All contents are copyright of their authors.