The ServerApplicationContext is intended to give access to the custom Business Logic on the server. Before this the only way to communicate with the server middle tier was via oData. Using the ServerApplicationContext it is possible to extend your Lightswitch Application serverside with other technologies such as ASP. NET MVC, ASP.NET WEBFORMS and ASP. NET WEBAPI.
It is not possible to acces the ServerApplicationContext from the Silverlight Client because
- the Silverlight Client communicates with the Server via oData
- the Silverlight Client is a portable dll, the Server is a .net framework dll, you cannot reference a .net framework dll from a portable library dll
- the Client and the Server share business logic code such as the entities through sharing code techniques and T4
- almost the same api that the ServerApplicationContext exposes is accessible to the Silverlight Client through the clientside available objects Application and Dataworkspace
If you want to access server side functionality from the Client you could:
- use operation table techniques, which uses a lightswitch table to pass parameters to the server and invoke your server side code in the _inserting eventhandler of the entity related to the operation table. This is, for example, the only way to implement functionality such as Sending Emails, because Silverlight portable library does not support Email functionality
- Extend your Lightswitch Server with ASP. NET MVC, ASP.NET Webforms or ASP.NET Web Api and in conjunction with the ServerApplicationContext code your server side functionality. After that you could invoke that functionality from the Silverlight Client using normal HTTP requests
Since Microsoft stopped developing Lightswitch and browsers which support plugins such as java, flash and silverlight are deprecated (the new Windows 10 Edge browser does not support any plug ins, silverlight included...) the way of preserving your development investments in lightswitch applications could be to deploy only the lightswitch server, expose your use cases through current asp.net techonologies and develop a new desktop client using a current techonology (such as WPF) that connects to the lightswitch middle tier through OData or other webservices that you could expose.
Hope this helps.