Hi Rocky,
I use MobileDictionary like below. Please notice the class Key drives from ReadOnlyBase.
[Serializable]
public class Data : ReadOnlyBase<Data>
{
public static PropertyInfo<MobileDictionary<Key, string>> DicProperty = RegisterProperty<MobileDictionary<Key, string>>(x => x.Dic);
public MobileDictionary<Key, string> Dic
{
get
{
var value = ReadProperty(DicProperty);
if (value == null)
{
value = new MobileDictionary<Key, string>();
LoadProperty(DicProperty, value);
}
return value;
}
}
...
}
When I run the app and get Data from the server the app throws an exception:
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Csla.Core.MobileDictionary`2.Csla.Serialization.Mobile.IMobileObject.SetChildren(SerializationInfo info, MobileFormatter formatter)
at Csla.Serialization.Mobile.MobileFormatter.DeserializeAsDTO(List`1 deserialized)
at Csla.Serialization.Mobile.MobileFormatter.Deserialize(List`1 data)
at Csla.Serialization.Mobile.MobileFormatter.Deserialize(XmlReader reader)
at Csla.Serialization.Mobile.MobileFormatter.Deserialize(Stream serializationStream)
at Csla.DataPortalClient.WcfProxy`1.proxy_FetchCompleted(Object sender, FetchCompletedEventArgs e)
I created a sample to illustrate the issue. You can download it from the link
http://www.mediafire.com/?wrin747gca2lx2a
That isn't a supported scenario, sorry.
Copyright (c) Marimer LLC