예제 #1
0
        /// <summary>
        /// Untransforms, if necessary, a List of values previously
        /// transformed by this (or an equivalent) CacheableResultTransformer.
        /// Each element of the list is untransformed in place (i.e, List
        /// elements are replaced with untransformed values) and the original
        /// List is returned.
        /// <para>
        /// If not unnecessary, the original List is returned
        /// unchanged.
        /// </para>
        /// </summary>
        /// <remarks>
        /// NOTE: If transformed values are a subset of the original
        /// tuple, then, on return, elements corresponding to
        /// excluded tuple elements will be null.
        /// </remarks>
        /// <param name="results">Results that were previously transformed.</param>
        /// <returns>results, with each element untransformed (if necessary).</returns>
        public IList UntransformToTuples(IList results)
        {
            if (_includeInTuple == null)
            {
                throw new InvalidOperationException("This transformer is not initialized");
            }
            if (_includeInTransformIndex == null)
            {
                results = _actualTransformer.UntransformToTuples(
                    results,
                    _tupleSubsetLength == 1
                    );
            }
            else
            {
                for (int i = 0; i < results.Count; i++)
                {
                    object[] tuple = _actualTransformer.UntransformToTuple(
                        results[i], _tupleSubsetLength == 1);
                    results[i] = Unindex(tuple);
                }
            }

            return(results);
        }
예제 #2
0
        /// <summary>
        /// Untransforms, if necessary, a List of values previously
        /// transformed by this (or an equivalent) CacheableResultTransformer.
        /// Each element of the list is untransformed in place (i.e, List
        /// elements are replaced with untransformed values) and the original
        /// List is returned.
        /// <para>
        /// If not unnecessary, the original List is returned
        /// unchanged.
        /// </para>
        /// </summary>
        /// <remarks>
        /// NOTE: If transformed values are a subset of the original
        /// tuple, then, on return, elements corresponding to
        /// excluded tuple elements will be null.
        /// </remarks>
        /// <param name="results">Results that were previously transformed.</param>
        /// <returns>results, with each element untransformed (if necessary).</returns>
        public IList UntransformToTuples(IList results)
        {
            if (_includeInTransformIndex == null)
            {
                results = _actualTransformer.UntransformToTuples(
                    results,
                    _tupleSubsetLength == 1
                    );
            }
            else
            {
                for (int i = 0; i < results.Count; i++)
                {
                    object[] tuple = _actualTransformer.UntransformToTuple(
                        results[i], _tupleSubsetLength == 1);
                    results[i] = Unindex(tuple);
                }
            }

            return(results);
        }