示例#1
0
        private bool ReferenceValuesAreEqual(QueryReferenceValue firstValueReference, QueryReferenceValue secondValueReference)
        {
            if (firstValueReference.EntitySetFullName != secondValueReference.EntitySetFullName)
            {
                return(false);
            }

            return(this.ValuesAreEqual(firstValueReference.KeyValue, secondValueReference.KeyValue));
        }
示例#2
0
        /// <summary>
        /// Creates the reference value for the given entity set name and key value
        /// </summary>
        /// <param name="setFullName">the entity set full name</param>
        /// <param name="keyValue">the key value</param>
        /// <returns>the refernce value</returns>
        /// <remarks>
        /// This will create a "dangling" reference, which Dereference will evaluate to query null value. It's only intended to be used:
        /// 1. when it's really a "dangling reference
        /// 2. dumping product output for comparision (in which case, Dereference evaluation is not valid anyway)
        /// </remarks>
        public QueryReferenceValue CreateReferenceValue(string setFullName, QueryRecordValue keyValue)
        {
            ExceptionUtilities.Assert(keyValue.Type is QueryRecordType, "Create reference value using key needs a value of query record type, not {0}.", keyValue.Type);

            var referenceValue = new QueryReferenceValue(this, null, this.EvaluationStrategy);

            referenceValue.SetReferenceValue(setFullName, keyValue);
            return(referenceValue);
        }
示例#3
0
        /// <summary>
        /// Creates the reference value for the given eneity value
        /// </summary>
        /// <param name="entityValue">the entity value</param>
        /// <returns>the reference value</returns>
        public QueryReferenceValue CreateReferenceValue(QueryStructuralValue entityValue)
        {
            ExceptionUtilities.Assert(entityValue.Type is QueryEntityType, "Create reference value needs a value of query entity type, not {0}.", entityValue.Type);

            var referenceValue = new QueryReferenceValue(this, null, this.EvaluationStrategy);

            referenceValue.SetReferenceValue(entityValue);
            return(referenceValue);
        }
示例#4
0
 /// <summary>
 /// Gets a <see cref="QueryReferenceValue"/> value indicating whether two values are equal.
 /// </summary>
 /// <param name="otherValue">The second value.</param>
 /// <returns>
 /// Instance of <see cref="QueryScalarValue"/> which represents the result of comparison.
 /// </returns>
 public QueryScalarValue EqualTo(QueryReferenceValue otherValue)
 {
     if ((this.IsNull && otherValue.IsNull) || object.ReferenceEquals(this.EntityValue, otherValue.EntityValue))
     {
         return(new QueryScalarValue(EvaluationStrategy.BooleanType, true, this.EvaluationError, this.EvaluationStrategy));
     }
     else
     {
         return(new QueryScalarValue(EvaluationStrategy.BooleanType, false, this.EvaluationError, this.EvaluationStrategy));
     }
 }
示例#5
0
        /// <summary>
        /// Gets a <see cref="QueryReferenceValue"/> value indicating whether two values are not equal.
        /// </summary>
        /// <param name="otherValue">The second value.</param>
        /// <returns>
        /// Instance of <see cref="QueryScalarValue"/> which represents the result of comparison.
        /// </returns>
        public QueryScalarValue NotEqualTo(QueryReferenceValue otherValue)
        {
            bool areEqual = (bool)this.EqualTo(otherValue).Value;

            return(new QueryScalarValue(EvaluationStrategy.BooleanType, !areEqual, this.EvaluationError, this.EvaluationStrategy));
        }