Table of Contents

Class NhQueryableInclude<T>

Namespace
Breeze.Persistence.NH
Assembly
Breeze.Persistence.NH.dll

Extends NhQueryable to add an Include function.

Include supports the OData $expand implementation, which retrieves related entities by following navigation properties. Note that Include is not the same as Fetch. Fetch performs a join operation, while Include causes as second query. Fetch can be faster, but Include preserves the row count sematics of the original query.

public class NhQueryableInclude<T> : NhQueryable<T>, IOrderedQueryable<T>, IOrderedQueryable, IQueryable<T>, IEnumerable<T>, IQueryableInclude, IQueryable, IEnumerable

Type Parameters

T
Inheritance
QueryableBase<T>
NhQueryable<T>
NhQueryableInclude<T>
Implements
Inherited Members
NhQueryable<T>.ToString()
NhQueryable<T>.EntityName
QueryableBase<T>.GetEnumerator()
QueryableBase<T>.Expression
QueryableBase<T>.Provider
QueryableBase<T>.ElementType
Extension Methods

Constructors

NhQueryableInclude(ISessionImplementor, bool)

Create a query which may be marked cachable.

Calls the base constructor, setting the Expression using NhQueryable. Needed because the NHibernate Linq parser chokes if NhQueryableInclude is in the expression.

public NhQueryableInclude(ISessionImplementor si, bool cacheable = false)

Parameters

si ISessionImplementor

Session

cacheable bool

True to set the query as cachable, false as not cacheable. Defaults to false.

Remarks

Note that some combinations of operations (.Select with .Where) result in errors from the NHibernate LINQ provider when using cacheable queries.

NhQueryableInclude(ISessionImplementor, string)

Create a cacheable query using the given cache region.

Calls the base constructor, setting the Expression using NhQueryable. Needed because the NHibernate Linq parser chokes if NhQueryableInclude is in the expression.

public NhQueryableInclude(ISessionImplementor si, string cacheRegion)

Parameters

si ISessionImplementor

Session

cacheRegion string

Cache Region to use for caching the query.
http://nhforge.org/doc/nh/en/#performance-querycache and http://nhforge.org/doc/nh/en/#caches

Remarks

Note that some combinations of operations (.Select with .Where) result in errors from the NHibernate LINQ provider when using cacheable queries.

NhQueryableInclude(IQueryProvider, Expression)

Create a query over an existing provider and expression. Used by LINQ operators as the query is built up.

public NhQueryableInclude(IQueryProvider provider, Expression expr)

Parameters

provider IQueryProvider

The query provider.

expr Expression

The expression built so far.

Methods

GetIncludes()

The navigation paths added by Include, or null if none were.

public IList<string>? GetIncludes()

Returns

IList<string>

The paths, or null.

Include(string)

Allows Include clauses to be added to NhQueryable objects.

public NhQueryableInclude<T> Include(string propertyPath)

Parameters

propertyPath string

Returns

NhQueryableInclude<T>

Examples

var query = new NhQueryableInclude<Customer>(session.GetSessionImplementation());
query = query.Include("Orders");