/// <summary> /// Visits the given QueryValue /// </summary> /// <param name="value">QueryValue being visited.</param> /// <returns>The result of visiting this QueryValue.</returns> public QueryValue Visit(QueryRecordValue value) { var result = value.Type.CreateNewInstance(); for (int i = 0; i < value.Type.Properties.Count; i++) { var propertyValue = value.GetMemberValue(i); var resultPropertyValue = this.ProcessResult(propertyValue); result.SetMemberValue(i, resultPropertyValue); } return(result); }
private void UpdateVisibleEntitiesGraphForRecord(QueryRecordValue recordValue, string[] spanPaths) { // we never take Includes into account for record properties, hence we can terminate/corrupt the current span path string newPath = "[record]"; if (!recordValue.IsNull) { for (int i = 0; i < recordValue.Type.Properties.Count; i++) { var originalValue = recordValue.GetMemberValue(i); this.UpdateVisibleEntitiesGraphForQueryValue(originalValue, newPath, spanPaths); } } }
/// <summary> /// Creates a copy of the given value recursively /// </summary> /// <param name="value">The value to copy</param> /// <returns>The copied value</returns> public QueryValue Visit(QueryRecordValue value) { return(this.HandleCommonCasesAndCache( value, () => value.Type.CreateNewInstance(), copy => { for (int i = 0; i < value.Type.Properties.Count; i++) { var memberValue = value.GetMemberValue(i); var memberValueCopy = memberValue.Accept(this); ((QueryRecordValue)copy).SetMemberValue(i, memberValueCopy); } })); }