public RetrieveMetadataChangesResponse(XmlNode response) { XmlNode results = XmlHelper.SelectSingleNode(response, "Results"); foreach (XmlNode nameValuePair in results.ChildNodes) { XmlNode key = XmlHelper.SelectSingleNode(nameValuePair, "key"); XmlNode value = XmlHelper.SelectSingleNode(nameValuePair, "value"); switch (XmlHelper.GetNodeTextValue(key)) { case "ServerVersionStamp": this.ServerVersionStamp = XmlHelper.GetNodeTextValue(value); break; case "DeletedMetadata": break; case "EntityMetadata": EntityMetadata = new List <EntityMetadata>(); for (int i = 0; i < value.ChildNodes.Count; i++) { XmlNode entity = value.ChildNodes[i]; EntityMetadata metaData = MetadataSerialiser.DeSerialiseEntityMetadata(new EntityMetadata(), entity); EntityMetadata.Add(metaData); } break; } } }
public RetrieveRelationshipResponse(XmlNode response) { XmlNode results = XmlHelper.SelectSingleNode(response, "Results"); foreach (XmlNode nameValuePair in results.ChildNodes) { XmlNode key = XmlHelper.SelectSingleNode(nameValuePair, "key"); if (XmlHelper.GetNodeTextValue(key) == "RelationshipMetadata") { XmlNode entity = XmlHelper.SelectSingleNode(nameValuePair, "value"); RelationshipMetadata = MetadataSerialiser.DeSerialiseRelationshipMetadata(entity); } } }
public string Serialise() { return(@"<request i:type='a:RetrieveMetadataChangesRequest' xmlns:a='http://schemas.microsoft.com/xrm/2011/Contracts'> <a:Parameters xmlns:b='http://schemas.datacontract.org/2004/07/System.Collections.Generic'> <a:KeyValuePairOfstringanyType> <b:key>ClientVersionStamp</b:key>" + Attribute.SerialiseValue(ClientVersionStamp, null) + @" </a:KeyValuePairOfstringanyType> <a:KeyValuePairOfstringanyType> <b:key>Query</b:key> " + MetadataSerialiser.SerialiseEntityQueryExpression(Query) + @" </a:KeyValuePairOfstringanyType> </a:Parameters> <a:RequestId i:nil='true' /> <a:RequestName>RetrieveMetadataChanges</a:RequestName> </request>"); }
public RetrieveAttributeResponse(XmlNode response) { XmlNode results = XmlHelper.SelectSingleNode(response, "Results"); XmlNode metaData = XmlHelper.SelectSingleNode(results.FirstChild, "value"); // Just serialise the option sets // Get the type string type = XmlHelper.GetAttributeValue(metaData, "i:type"); switch (type) { case "c:PicklistAttributeMetadata": AttributeMetadata = MetadataSerialiser.DeSerialisePicklistAttributeMetadata(new PicklistAttributeMetadata(), metaData); break; // TODO: Add in more attributes types } }
public RetrieveAllEntitiesResponse(XmlNode response) { XmlNode results = XmlHelper.SelectSingleNode(response, "Results"); foreach (XmlNode nameValuePair in results.ChildNodes) { XmlNode key = XmlHelper.SelectSingleNode(nameValuePair, "key"); if (XmlHelper.GetNodeTextValue(key) == "EntityMetadata") { XmlNode values = XmlHelper.SelectSingleNode(nameValuePair, "value"); EntityMetadata = new EntityMetadata[values.ChildNodes.Count]; for (int i = 0; i < values.ChildNodes.Count; i++) { XmlNode entity = values.ChildNodes[i]; EntityMetadata metaData = MetadataSerialiser.DeSerialiseEntityMetadata(new EntityMetadata(), entity); EntityMetadata[i] = metaData; } } } }