|
|
SilverLight 4.0 Deployment How to improve efficency of your Silverlight application PreRequisite: Visual Studio 2010 |
|
XAP file and DLLs Reducing the size of your XAP file is a good idea as it may contain DLLs (and other resources) that have already been downloaded previously and are contained in the browser assembly cache. Bandwidth is a precious thing and you don't want to waste it ! For this article we will use our DBiz ECommerce Open Source application as an example (to get the source code go to http://sourceforge.net/projects/dbiz
How easy was that! Is it too good to be true? Well, almost, there are additional steps to take when caching your own libraries: If you have many Silverlight applications, generic code and generic controls you will want to generate a DLL resource. This is the case for the DBIZ ECommerce solution which contains the DBizControls project as well as the ShopCart project. The DBizControls project outputs a DLL which is referenced by the ShopCart Application. You will notice that the DBizControls.dll file remained in the ShopCart XAP package (you can peak inside the package as a XAP file is the same as a ZIP file with a different extension, so just use your favorite ZIP viewer and you will see the contents). The reason is that a Library must first be signed to support caching:
Next, you must create a map file for use in the External Part manifest of the main application (ShopCart):
|
|
IMAGES Images can make XAP files very large. An alternative is to load images on demand. Here is some code to enable image loading on demand: Note that the WebClient does not support concurrent IO operations, therefore you must load each image on a seperate WebClient object each time (this code is from our Tools4Wives project). |
|
SEPARATING CONTENT AND DATA Bandwidth must be considered when developing Silverlight internet apps. Files can get very large with Silverlight, and if servers are busy delivering dynamic data and large static content from the same site, user wait times can increase. A solution is to serve content and data from 2 different sites, of course this presents the challenge of cross domain support (see DBiz OpenSource Project for ways to deal with cross domain situations). At GMG Software we have tackled this issue by dedicating servers at our HQ to serving dynamic content, that is the XML Web Services; the DLLs and XAP files are delivered from another site. |
|
Loadin XAP Files Dynamically Off the MEF method: A Smaller XAP Preloader for Silverlight MEF Xap Loading MEF Xap Loading Video MEF Xap Partitioning MEF Silverlight 4 Toolkit MEF again MEF Community Site MEF Overview |