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
-
IQueryable<T>IEnumerable<T>
- Inherited Members
-
NhQueryable<T>.ToString()NhQueryable<T>.EntityNameQueryableBase<T>.GetEnumerator()QueryableBase<T>.ExpressionQueryableBase<T>.ProviderQueryableBase<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
siISessionImplementorSession
cacheableboolTrue 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
siISessionImplementorSession
cacheRegionstringCache 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
providerIQueryProviderThe query provider.
exprExpressionThe expression built so far.
Methods
GetIncludes()
The navigation paths added by Include, or null if none were.
public IList<string>? GetIncludes()
Returns
Include(string)
Allows Include clauses to be added to NhQueryable objects.
public NhQueryableInclude<T> Include(string propertyPath)
Parameters
propertyPathstring
Returns
Examples
var query = new NhQueryableInclude<Customer>(session.GetSessionImplementation());
query = query.Include("Orders");