コード例 #1
0
        private T GetValue <T>(string name)
        {
            ChangeTrackedField field = null;

            fields.TryGetValue(name, out field);
            if (field == null || field.Value == null)
            {
                return(default(T));
            }
            return((T)field.Value);
        }
コード例 #2
0
        internal XElement ToXml()
        {
            XElement e = new XElement("institution");

            foreach (var field in this.fields)
            {
                ChangeTrackedField ctf = field.Value;
                XElement           fx  = new XElement(ctf.Name, ctf.Value);
                if (ctf.LastChange.HasValue)
                {
                    // remember when it was last changed.
                    fx.SetAttributeValue("changed", ctf.LastChange.Value);
                }
                e.Add(fx);
            }
            return(e);
        }
コード例 #3
0
        private void SetValue(string name, object value, DateTime?changed)
        {
            ChangeTrackedField field = null;

            fields.TryGetValue(name, out field);
            if (field == null)
            {
                field = new ChangeTrackedField()
                {
                    Name = name
                };
                fields[name] = field;
            }
            if (field.Value != value)
            {
                field.Value      = value;
                field.LastChange = changed;
            }
        }