We're working with the Visual Studio 2013 version of LightSwitch, and have a number of areas in our HTML Client screens where we've used the following approach to retrieve an entity with a specific id: -
myapp.activeDataWorkspace.ApplicationData.Tables.filter("Id eq " + msls._toODataString(idToFind, ":Int32")).execute()
As we're interested in improving the performance of these screens, I wondered if anyone knows if the following alternative approach would make any difference to the speed? : -
myapp.activeDataWorkspace.ApplicationData.Tables_SingleOrDefault(idToFind).execute()
Whilst the second approach seems more appropriate in this type of situation, as we've a significant number of the former method, I wanted to quantify the value of this change before initiating it (and the re-testing this would entail).
Both approaches will produce SQL and execute it on the server. The SQL should be similar/identical and performance will be near identical. If you want to see the SQL being produced i suggest you open up the "SQL Server Profiler" and run a Trace! The trace will also show you execution time taken. Side note: Your performance gains will come from correctly configured Table Indexes.