Esempio n. 1
0
            /// <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);
            }
Esempio n. 2
0
        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);
         }
     }));
 }
 /// <summary>
 /// Visits a QueryRecordValue and returns the clr value of the record value
 /// </summary>
 /// <param name="value">The QueryRecordValue which contains the clr value of the record value</param>
 /// <returns>The clr instance of the record value</returns>
 public object Visit(QueryRecordValue value)
 {
     throw new NotImplementedException();
 }
Esempio n. 5
0
 /// <summary>
 /// Visits the QueryRecordValue
 /// </summary>
 /// <param name="value">Value to visit</param>
 /// <returns>will always throw</returns>
 public string Visit(QueryRecordValue value)
 {
     throw new TaupoNotSupportedException();
 }
Esempio n. 6
0
 /// <summary>
 /// Compares the object with the expected record value.
 /// </summary>
 /// <param name="expected">Expected value.</param>
 /// <param name="actual">Actual value.</param>
 /// <param name="path">The path to the compared object (for debugging purposes).</param>
 /// <param name="shouldThrow">Should exception be thrown if error is encountered.</param>
 /// <returns>Result of the comparison, Success or Failure.</returns>
 protected virtual ComparisonResult CompareRecord(QueryRecordValue expected, object actual, string path, bool shouldThrow)
 {
     throw new TaupoNotSupportedException("Comparison of query record value is not supported here.");
 }