Prologue:In my previous article, we discussed queries in LightSwitch. As we know how to create queries in LightSwitch, today we shall discuss the two different types of queries called Composed and Scalar queries based on their functionality. What is Composed Query?A Composed query operates on the results obtained from the source query i.e. these type of queries will take another query as their source.There are some benefits in using a query as a source of another query. The composed query reuses the logic built on the designer and the code written in the PreprocessQuery () method of the source query. In addition, it helps in maintainability. It is easier to update a single query than make changes on multiple queries.What is Scalar Query?A Scalar query returns only one result i.e. if you need to get a single result from thousands of records you can use the Scalar queries.Let us see the demo application which will use the Composed and Scalar queries to demonstrate how to create and use it.Preparing the Solution:Start VS 2010; create a LightSwitch desktop application named "ComposedScalarQueryInLSBeta2" as shown in the figure below. Follow the No: # to create the Desktop LightSwitch application.The Entity Designer: Let us create a Table. This new screen for Beta 2 is not available in Beta 1. Select the option shown rounded to create a new table.After clicking on the "Create new table" option, the Entity Designer will be displayed to create the Entity required. To change the Table name simply click on the Header of the Entity Designer and give the Name. In our sample application we have given the name Person.Adding Composed Query: To add a query,
Hi everyone,This is jagan . Working as Software Engineer for SDL International. Bengaluru, India.Thanks,Be simple & sample - Jaganhttp://www.iamtechmad.com,
C# Corner. All contents are copyright of their authors.