Silverlight: Best Place to Load Settings

Silverlight: Best Place to Load Settings

Old forum URL: forums.lhotka.net/forums/t/11986.aspx


MadGerbil posted on Thursday, May 16, 2013

Greetings:

I've a Silverlight application that needs to have a static class called "Settings".   This class will be a read only base class with about 2 dozen settings that should be available anywhere in the UI layer.  I'm not really sure where the best place to put that class might be ... that is, the best place to have the system make an async call to load up the settings.

Maybe Application_Startup?

Thoughts?

skagen00 replied on Thursday, May 16, 2013

We do it when the application is starting up, yep.  (System with hundreds of clients)

I feel like the user is potentially already getting the hit of getting the .xap, loading Silverlight itself - might as well just get the big hit up-front and load any needed "application data".

What we do, and I would very highly recommend, is to stash this fetched data in Isolated Storage with a "hash key".  Calculate it yourself because 32-bit & 64-bit "GetHashCode" can differ (!) (I could cite an article, but just an fyi). Make the call to the server pass this hash value so that when the server fetches the object and calculates the hash it can determine: "you have the latest" and just return "null" to tell the client that it has the most recent information.

We actually have one business object responsible for getting the "whole shebang" (multiple business objects worth of data) as I felt like one server call is probably more efficient than multiple, for the various pieces of data you'd want to load up-front.

 

Copyright (c) Marimer LLC