Exemplo n.º 1
0
        /// <summary>
        /// Returns a CacheableResultTransformer that is used to transform
        /// tuples to a value(s) that can be cached.
        /// </summary>
        /// <param name="transformer">a tuple subset result transformer;
        ///   must be non-null;</param>
        /// <param name="aliases">the aliases that correspond to the tuple;
        ///   if it is non-null, its length must equal the number
        ///   of true elements in includeInTuple[]</param>
        /// <param name="includeInTuple">array with the i-th element indicating
        ///   whether the i-th expression returned by a query is
        ///   included in the tuple; the number of true values equals
        ///   the length of the tuple that will be transformed;
        ///   must be non-null</param>
        /// <returns>a CacheableResultTransformer that is used to transform
        ///    tuples to a value(s) that can be cached.</returns>
        private static CacheableResultTransformer Create(ITupleSubsetResultTransformer transformer,
                                                         string[] aliases,
                                                         bool[] includeInTuple)
        {
            if (transformer == null)
            {
                throw new ArgumentNullException("transformer");
            }

            int tupleLength = ArrayHelper.CountTrue(includeInTuple);

            if (aliases != null && aliases.Length != tupleLength)
            {
                throw new ArgumentException(
                          "If aliases is not null, then the length of aliases[] must equal the number of true elements in includeInTuple; " +
                          "aliases.length=" + aliases.Length + "tupleLength=" + tupleLength
                          );
            }

            return(new CacheableResultTransformer(
                       includeInTuple,
                       transformer.IncludeInTransform(aliases, tupleLength)
                       ));
        }
Exemplo n.º 2
0
 public CacheableAliasToBeenResultTransformer(ITupleSubsetResultTransformer baseTransformer, string[] aliases)
 {
     this.baseTransformer = baseTransformer;
     this.aliases         = aliases;
 }