can i maintain a state of Dictionary bag

can i maintain a state of Dictionary bag

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


wasiuddin.786 posted on Saturday, February 19, 2011

 

 private Dictionary<string, object> _inputProps;

 public Dictionary<string, object> InputProperties

        {

            get { return this._inputProps; }

        } 

by using OnGetState,OnSetState

_inputProps = info.GetValue<Dictionary<string, object>>("_inputProps");

RockfordLhotka replied on Saturday, February 19, 2011

MobileFormatter requires all values in the object graph be primitive types or to implement IMobileObject.

There is a MobileDictionary type in Csla.Core that implements IMobileObject. It has some limitations on the <K,V> types, but it generally is the same as Dictionary.

Of course the <K,V> types must both be either primitive or must implement IMobileObject.

You can avoid the requirement for a child value (contained value) to implement IMobileObject if you can have the containing object take over the serialization of the child. That's usually very hard to do because it means the child's state must be completely public.

wasiuddin.786 replied on Monday, February 21, 2011

i used MobileDictionary <K,V> also k=string v=propertyinfo,

i am sending multiple property from business for serer side validation it is on array of propertyinfo

 

foreach(var obj in arrayofpropertyifo)

{

mobdic[obj.name,obj.value]

}

still giving error data-contract serialization

RockfordLhotka replied on Monday, February 21, 2011

The CSLA PropertyInfo<T> type is not serializable. Nor is the System.Reflection PropertyInfo type.

Copyright (c) Marimer LLC