Exemple #1
0
        /// <summary>
        /// Sets the fetch mode.
        /// </summary>
        /// <typeparam name="T">Type setting fetch mode for.</typeparam>
        /// <typeparam name="TProperty">The type of the property.</typeparam>
        /// <param name="criteria">The criteria.</param>
        /// <param name="associationPropertyExpression">The association property expression.</param>
        /// <param name="mode">The mode to set.</param>
        /// <returns>A <see cref="DetachedCriteria"/></returns>
        public static DetachedCriteria SetFetchMode <T, TProperty>(
            this DetachedCriteria criteria, Expression <Func <T, TProperty> > associationPropertyExpression, FetchMode mode)
        {
            var associationPath = PropertyHelper.ExtractPropertyName(associationPropertyExpression);

            // criteria.SetFetchMode(associationPath, mode );
            criteria.Fetch(associationPath);
            return(criteria);
        }