private void ParseResponseUsingSchema(FetchXmlBuilder schema, DataRow row, Entity response) { foreach (var attribute in schema.Attributes) { if (attribute.IsLookup) { row[attribute.Name] = GetEntityReferenceValue(response, attribute.Name); row[attribute.Name + "name"] = GetEntityReferenceName(response, attribute.Name); } else { row[attribute.Name] = GetValue(response, attribute.Name); } } }
private static void SetTableColumnsFromSchema(FetchXmlBuilder schema, DataTable output) { foreach (var attribute in schema.Attributes) { if (attribute.IsLookup) { output.Columns.Add(attribute.Name, typeof (Guid)); output.Columns.Add(attribute.Name + "name", typeof (string)); } else if (attribute.IsPrimaryKey) output.Columns.Add(attribute.Name, typeof (Guid)); else if (attribute.IsDate) output.Columns.Add(attribute.Name, typeof (DateTime)); else output.Columns.Add(attribute.Name, typeof (string)); } }