private object GetPropertyChainValue(EntityRecord record, string propertyChain) { using (record.Session.ElevateRead()) { if (!propertyChain.Contains('.')) { return(record.GetValue(propertyChain)); } var props = propertyChain.SplitNames('.'); var currRec = record; object result = null; foreach (var prop in props) { result = currRec.GetValue(prop); if (result is EntityBase) { currRec = EntityHelper.GetRecord(result); } else { return(result); // stop as sson as we reach non-entity } } return(result); } //using } //method
private void MarkTargetAsModified(EntityRecord record) { var target = record.GetValue(_member); if (target == null) { return; } var targetRec = (target as EntityBase).Record; if (targetRec.Status == EntityStatus.Loaded) { targetRec.Status = EntityStatus.Modified; } }
public static string SerializeData(this EntityRecord record) { var xmlDoc = new XmlDocument(); var elData = xmlDoc.CreateElement("Data"); xmlDoc.AppendChild(elData); foreach (var m in record.EntityInfo.Members) { switch (m.Kind) { case MemberKind.Column: var value = record.GetValue(m); var el = xmlDoc.CreateElement(m.MemberName); el.InnerText = ConvertHelper.ValueToString(value); elData.AppendChild(el); break; //other kinds to implement if necessary } //switch } //foreach m return(xmlDoc.OuterXml); }