예제 #1
0
        // this is only heppening when reading from product or creating dangling reference
        internal void SetReferenceValue(string entitySetFullName, QueryRecordValue keyValue)
        {
            ExceptionUtilities.CheckStringArgumentIsNotNullOrEmpty(entitySetFullName, "entitySetFullName");
            ExceptionUtilities.CheckArgumentNotNull(keyValue, "keyValue");

            this.EntitySetFullName = entitySetFullName;
            this.KeyValue          = keyValue;
            this.EntityValue       = this.Type.QueryEntityType.NullValue;
        }
예제 #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
        internal void SetReferenceValue(QueryStructuralValue entityValue)
        {
            ExceptionUtilities.CheckArgumentNotNull(entityValue, "entityValue");
            this.EntityValue = entityValue;

            // compute key value
            QueryEntityType entityType = this.Type.QueryEntityType;
            var             keyType    = new QueryRecordType(this.EvaluationStrategy);

            keyType.AddProperties(entityType.Properties.Where(m => m.IsPrimaryKey));

            this.KeyValue = keyType.CreateNewInstance();

            for (int i = 0; i < keyType.Properties.Count; i++)
            {
                this.KeyValue.SetMemberValue(i, entityValue.GetValue(keyType.Properties[i].Name));
            }

            var set = entityType.EntitySet;

            this.EntitySetFullName = set.Container.Name + "." + set.Name;
        }
예제 #4
0
        private bool RecordValuesAreEqual(QueryRecordValue firstValueRecord, QueryRecordValue secondValueRecord)
        {
            if (firstValueRecord.IsNull)
            {
                return(secondValueRecord.IsNull);
            }
            else if (secondValueRecord.IsNull)
            {
                return(false);
            }

            for (int index = 0; index < firstValueRecord.Type.Properties.Count; index++)
            {
                QueryValue innerFirstvalue  = firstValueRecord.GetMemberValue(index);
                QueryValue innerSecondvalue = secondValueRecord.GetMemberValue(index);

                if (!this.ValuesAreEqual(innerFirstvalue, innerSecondvalue))
                {
                    return(false);
                }
            }

            return(true);
        }