9using System.Collections.Generic;
10using System.Runtime.Serialization;
15#if (ANDROID || IOS) || NETFX_CORE
16 internal class FieldDataList :
Csla.Core.MobileObject,
Csla.
Serialization.Mobile.ISerializationNotification
18 internal class FieldDataList : ISerializable
22 private Dictionary<string, int> _fieldIndex =
new Dictionary<string, int>();
23#if (ANDROID || IOS) || NETFX_CORE
26 private List<IFieldData> _fields =
new List<IFieldData>();
29 public FieldDataList()
32 public bool TryGetValue(
string key, out IFieldData result)
35 if (_fieldIndex.TryGetValue(key, out index))
37 result = _fields[index];
47 public bool ContainsKey(
string key)
49 return _fieldIndex.ContainsKey(key);
52 public IFieldData GetValue(
string key)
54 return _fields[_fieldIndex[key]];
57 public void Add(
string key, IFieldData value)
60 _fieldIndex.Add(key, _fields.Count - 1);
63 internal string FindPropertyName(
object value)
65 foreach (var item
in _fields)
66 if (ReferenceEquals(item.Value, value))
71#if (ANDROID || IOS) || NETFX_CORE
77 public List<IFieldData> GetFieldDataList()
83#if (ANDROID || IOS) || NETFX_CORE
84 #region ISerializationNotification Members
91 private void RebuildIndex()
94 foreach (IFieldData item
in _fields)
96 _fieldIndex.Add(item.Name, position);
103 #region ISerializable
105 protected FieldDataList(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
107 _fields = (List<IFieldData>)(info.GetValue(
"Fields", typeof(List<IFieldData>)));
111 public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
113 info.AddValue(
"Fields", _fields);
116 private void RebuildIndex()
119 foreach (IFieldData item
in _fields)
121 _fieldIndex.Add(item.Name, position);
Inherit from this base class to easily create a serializable list class.
Interface defining callback methods used by the SerializationFormatterFactory.GetFormatter().
void Deserialized()
Method called on an object after deserialization is complete.
@ Serialization
The object is being serialized for a clone or data portal operation.
@ Serializable
Prevents updating or inserting until the transaction is complete.