In this article I am going to describes how to develop many to many relationship in LightSwitch 2012.
In my previous article I described how to establish a relationship among multiple tables using LightSwitch in Visual Studio 2012. (See: http://www.c-sharpcorner.com/uploadfile/18ddf7/creating-relationship-between-multiple-tables-in-lightswitch/).I am now proceeding from that article.Here we will see how to develop a many-to-many relationship in LightSwitch 2012.Note: A many-to-many relationship is not supported in LightSwitch.Here I am providing an easy solution for creating ammany-to-many relationship in Lightswitch 2012.Procedure for showing a many-to-many relationship in LightSwitch 2012.Step 1To add a small amount of data we need to develop the screens. In the Solution Explorer, right-click on Screens and choose "Add Screens".Step 2Choose the "Editable DataGrid Screen" from the Screen Template. Under Screen Information we provide the Screen Name and select "Customer" from the Screen Data and then click "OK".Do the same for the Item table, in other words once again choose the "Editable DataGrid Screen" from the Screen Template. Under Screen Information we provide the Screen Name and select "Item" from the Screen Data and then click "OK".Step 3Add another Screen. Now this time choose "List and Details Screen" from the Screen Template. Under Screen Information we provide the Screen Name and select "Customer" from the Screen Data. Mark the Customer CustomerItemMaps checkbox as checked and then click "OK".Add another List and Details Screen. This time select "Item" from the Screen Data and mark the Item CustomerItemMaps checkbox as checked and click "OK".Step 4Press F5 to run the application. You will see the Editable Customer Grid Screen open. Enter some data and click on the "Save" Button.If sometimes you are unable to get the Editable Customer Grid Screen then select it from the Tasks Menu.Step 5Similarly, select the Editable Item Grid from the Tasks Menu and enter some data and save it. Step 6Now we can test the relationship. Choose the Customer List Detail from the Tasks Menu.The list of customers along with the item appears.We can easily relate items to the customers. For example select the "Satya" from the Customer and from the drop down list of Items choose any item.Step 7Now select the Item List detail from the Tasks Menu and we can now also relate customer to items by selecting the specific customer.In this way we can establish the relationship between tables.
Printing in C# Made Easy