The LinqScratchPad allows a user to execute code snippets. As describe on the Sitecore Blog:
LinqScratchPad will allow you to run LINQ queries against your indexes all within the browser! Not only this but you can play around with different POCO’s, settings and also test the performance of your queries.
When executing the code, the result will be returned in a tabular form as shown below:
However, there is currently a limitation with the LinqScratchPad. The user cannot execute code that is being referenced from the user’s own assembly. In this post, I will explain the module that I have developed so that it takes into consideration the user’s assembly.
The module name is called LinqScratchPadExtender since I am extending the module to a higher level. Currently, the LinqScratchPad allows only the following assemblies:
However, by extending the LinqScratchPad, the module will allow for using your own assemblies. Below is the screenshot of the new UI:
In each textbox you can input the different assembly name. Moreover, compare to the current LinqScratchPad, you no more have to stick to the defined Namespace and Method name. You can use your own Method and Namespace.
Parameters are also available. Suppose you have a method that takes 2 parameters, you can easily now input its value in the Parameter Values textbox.
This extension of the LinqScratchPad will help if you have a Custom Property class that returns values from the Index.
To access the module, enter the path as follows: