9using System.Collections.Generic;
13using System.Runtime.Serialization;
22 [System.Diagnostics.DebuggerNonUserCode]
40 public object Value {
get;
set; }
56 #region IMobileObject Members
89 Value = info.GetValue<
object>(
"FieldData.Value");
90 EnumTypeName = info.GetValue<
string>(
"FieldData.EnumTypeName");
91 IsDirty = info.GetValue<
bool>(
"FieldData.IsDirty");
125 #region IMobileObject Members
171 ReferenceId = info.GetValue<
int>(
"ChildData.ReferenceId");
172 IsDirty = info.GetValue<
bool>(
"ChildData.IsDirty");
193 private Dictionary<string, ChildData> _children =
new Dictionary<string, ChildData>();
200 get {
return _children; }
201 set { _children = value; }
204 private Dictionary<string, FieldData> _values =
new Dictionary<string, FieldData>();
209 public Dictionary<string, FieldData>
Values
211 get {
return _values; }
212 set { _values = value; }
258 public void AddValue(
string name,
object value,
bool isDirty)
260 _values.Add(name,
new FieldData { Value = value, IsDirty = isDirty });
278 public void AddValue(
string name,
object value,
bool isDirty,
string enumTypeName)
280 _values.Add(name,
new FieldData { Value = value, IsDirty = isDirty, EnumTypeName = enumTypeName});
297 var value = _values[name].Value;
298 return (value !=
null ? (T)Utilities.CoerceValue<T>(value.GetType(),
null, value) : (T)value);
302 throw new InvalidOperationException(
string.Format(
"SerializationInfo.GetValue: {0}", name), ex);
332 public void AddChild(
string name,
int referenceId,
bool isDirty)
337 #region IMobileObject Members
371 foreach (
string key
in _children.Keys)
377 foreach (
string key
in _values.Keys)
395 ReferenceId = info.GetValue<
int>(
"SerializationInfo.ReferenceId");
396 TypeName = info.GetValue<
string>(
"SerializationInfo.TypeName");
412 foreach (
string key
in info.Children.Keys)
414 int referenceId = info.Children[key].ReferenceId;
415 object serialized = formatter.GetObject(referenceId);
418 _children.Add(key, (
ChildData)serialized);
Object that contains information about a single child reference.
void SetState(SerializationInfo info)
Method called by MobileFormatter when an object should be deserialized.
bool IsDirty
Indicates whether the child is dirty.
ChildData()
Creates instance of object.
void SetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should deserialize its child references.
int ReferenceId
Reference number for the child.
void GetState(SerializationInfo info)
Method called by MobileFormatter when an object should serialize its data.
void GetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should serialize its child references.
Object that contains information about a single field.
FieldData()
Creates an instance of the object.
void SetState(SerializationInfo info)
Sets state information.
string EnumTypeName
If non-null, indicates that the value is a integer value representing the specified enum type.
void GetChildren(SerializationInfo info, MobileFormatter formatter)
Gets child serialization information.
void SetChildren(SerializationInfo info, MobileFormatter formatter)
Sets child serialization information.
void GetState(SerializationInfo info)
Gets state information.
bool IsDirty
Indicates whether the field is dirty.
Object containing the serialization data for a specific object.
Dictionary< string, FieldData > Values
Dictionary containg field data.
void GetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should serialize its child references.
int ReferenceId
Reference number for this object.
string TypeName
Assembly-qualified type name of the object being serialized.
void AddValue(string name, object value, bool isDirty, string enumTypeName)
Adds a value to the list of fields.
void GetState(SerializationInfo info)
Method called by MobileFormatter when an object should serialize its data.
Dictionary< string, ChildData > Children
Dictionary containing child reference data.
SerializationInfo()
Creates an instance of the object.
void SetState(SerializationInfo info)
Method called by MobileFormatter when an object should be deserialized.
void AddChild(string name, int referenceId)
Adds a child to the list of child references.
void AddValue(string name, object value)
Adds a value to the serialization stream.
T GetValue< T >(string name)
Gets a value from the list of fields.
void AddChild(string name, int referenceId, bool isDirty)
Adds a child to the list of child references.
void AddValue(string name, object value, bool isDirty)
Adds a value to the list of fields.
void SetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should deserialize its child references.
Interface to be implemented by any object that supports serialization by the SerializationFormatterFa...
@ Serializable
Prevents updating or inserting until the transaction is complete.