/// <summary>
        /// Copy all properties to a given <see cref="IDetachedQuery"/>.
        /// </summary>
        /// <param name="destination">The given <see cref="IDetachedQuery"/>.</param>
        /// <remarks>
        /// The method use <see cref="IDetachedQuery"/> to set properties of <paramref name="destination"/>.
        /// </remarks>
        public void CopyTo(IDetachedQuery destination)
        {
            destination.SetMaxResults(selection.MaxRows)
            .SetFirstResult(selection.FirstRow)
            .SetCacheable(cacheable)
            .SetReadOnly(readOnly)
            .SetTimeout(selection.Timeout)
            .SetFlushMode(flushMode)
            .SetFetchSize(selection.FetchSize);
            if (!string.IsNullOrEmpty(comment))
            {
                destination.SetComment(comment);
            }
            if (!string.IsNullOrEmpty(cacheRegion))
            {
                destination.SetCacheRegion(cacheRegion);
            }
            if (cacheMode.HasValue)
            {
                destination.SetCacheMode(cacheMode.Value);
            }
            if (resultTransformer != null)
            {
                destination.SetResultTransformer(resultTransformer);
            }
            foreach (KeyValuePair <string, LockMode> mode in lockModes)
            {
                destination.SetLockMode(mode.Key, mode.Value);
            }

            SetParametersTo(destination);
        }
示例#2
0
        /// <summary>
        /// Copy all properties to a given <see cref="IDetachedQuery"/>.
        /// </summary>
        /// <param name="destination">The given <see cref="IDetachedQuery"/>.</param>
        /// <remarks>
        /// The method use <see cref="IDetachedQuery"/> to set properties of <paramref name="destination"/>.
        /// </remarks>
        public void CopyTo(IDetachedQuery destination)
        {
            destination.SetMaxResults(selection.MaxRows)
                .SetFirstResult(selection.FirstRow)
                .SetCacheable(cacheable)
                .SetReadOnly(readOnly)
                .SetTimeout(selection.Timeout)
                .SetFlushMode(flushMode);
            if (!string.IsNullOrEmpty(cacheRegion))
                destination.SetCacheRegion(cacheRegion);
            if (cacheMode.HasValue)
                destination.SetCacheMode(cacheMode.Value);
            if (resultTransformer != null)
                destination.SetResultTransformer(resultTransformer);
            foreach (KeyValuePair<string, LockMode> mode in lockModes)
                destination.SetLockMode(mode.Key, mode.Value);

            SetParametersTo(destination);
        }