Silverlight 2.0 doesn't have an equivalent to the BinaryFormatter or NetDataContractSerializer. This makes some things quite challenging - in my case building CSLA Light. CSLA .NET requires high-fidelity serialization both for implementation of the Clone() operation and within the data portal. I've been working on building a Silverlight-compatible equivalent to the BinaryFormatter/NDCS. It turns out to be quite hard due to the limitations of the Silverlight sandbox. For example, Silverlight does have reflection, even against private fields. However, you can only get or set a private field with code inside the same class as the field declaration . You can't get/set a field from another object, or even from a base class or subclass. The reflection call must be in the same class ! At this point I have a prototype serializer that works in some limited scenarios. It is a starting point. Some aspects aren't ideal, but may just be the way they are to get around how Silverlight works. Still, the end result is relatively cool. To use the serializer: Build the Csla project (it is a Silverlight Class Library) and reference it from your Silverlight application In your business class, add a using/Imports statement for Csla.Serialization Add the Serializable attribute to your class You class must also either inherit from MobileObject or implement the IMobileObject interface (I recommend using inheritance, as otherwise you'll have to write a lot of nasty code) You must override GetValue() and
Read More...