예제 #1
0
        /// <summary>
        /// Overrides the method in QueryHelper to perform the $expands in NHibernate.
        /// Also populates the ExpandTypeMap that controls lazy initialization and serialization.
        /// </summary>
        /// <param name="queryable"></param>
        /// <param name="expandsQueryString"></param>
        /// <returns></returns>
        public override IQueryable ApplyExpand(IQueryable queryable, string expandsQueryString)
        {
            if (string.IsNullOrWhiteSpace(expandsQueryString)) return queryable;
            var session = GetSession(queryable);
            var fetcher = new NHEagerFetch(session.SessionFactory);
            queryable = fetcher.ApplyExpansions(queryable, expandsQueryString, expandMap);

            return queryable;
        }
예제 #2
0
        /// <summary>
        /// Performs expands based on the list of strings in queryable.GetIncludes().
        /// Also populates the ExpandTypeMap that controls lazy initialization and serialization.
        /// </summary>
        /// <param name="queryable"></param>
        /// <returns></returns>
        public IQueryable ApplyExpand(IQueryableInclude queryable)
        {
            var expands = queryable.GetIncludes();
            if (expands == null || expands.Count == 0) return queryable;
            var session = GetSession(queryable);
            var fetcher = new NHEagerFetch(session.SessionFactory);
            var expandedQueryable = fetcher.ApplyExpansions(queryable, expands.ToArray(), expandMap);

            return expandedQueryable;
        }
예제 #3
0
        /// <summary>
        /// Overrides the method in QueryHelper to perform the $expands in NHibernate.
        /// Also populates the ExpandTypeMap that controls lazy initialization and serialization.
        /// </summary>
        /// <param name="queryable"></param>
        /// <param name="expandsQueryString"></param>
        /// <returns></returns>
        public override IQueryable ApplyExpand(IQueryable queryable, string expandsQueryString)
        {
            if (string.IsNullOrWhiteSpace(expandsQueryString))
            {
                return(queryable);
            }
            var session = GetSession(queryable);
            var fetcher = new NHEagerFetch(session.SessionFactory);

            queryable = fetcher.ApplyExpansions(queryable, expandsQueryString, expandMap);

            return(queryable);
        }
예제 #4
0
        /// <summary>
        /// Performs expands based on the list of strings in queryable.GetIncludes().
        /// Also populates the ExpandTypeMap that controls lazy initialization and serialization.
        /// </summary>
        /// <param name="queryable"></param>
        /// <returns></returns>
        public IQueryable ApplyExpand(IQueryableInclude queryable)
        {
            var expands = queryable.GetIncludes();

            if (expands == null || expands.Count == 0)
            {
                return(queryable);
            }
            var session           = GetSession(queryable);
            var fetcher           = new NHEagerFetch(session.SessionFactory);
            var expandedQueryable = fetcher.ApplyExpansions(queryable, expands.ToArray(), expandMap);

            return(expandedQueryable);
        }