Table of Contents

Class NHEagerFetch

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

Converts OData-style $expand clauses into NHibernate Fetch commands. Adapted from NhQueryableEnumeratorAttribute.cs found in https://github.com/PeteGoo/NHibernate.QueryService

public class NHEagerFetch
Inheritance
NHEagerFetch
Inherited Members

Constructors

NHEagerFetch(ISessionFactory)

Create a fetch builder for a session factory.

public NHEagerFetch(ISessionFactory sessionFactory)

Parameters

sessionFactory ISessionFactory

Supplies the NHibernate class metadata that says what each expand path means.

Methods

ApplyExpansions(ICriteria, string[], ISessionFactory, IDictionary<Type, List<string>>?)

Add the Fetch clauses to the query according to the given expand paths, using the ICriteria API

public static ICriteria ApplyExpansions(ICriteria criteria, string[] expandPaths, ISessionFactory sessionFactory, IDictionary<Type, List<string>>? expandMap = null)

Parameters

criteria ICriteria

The query to expand

expandPaths string[]

The names of the properties to expand. May include nested paths of the form "Property/SubProperty"

sessionFactory ISessionFactory

Provides the NHibernate metadata for the classes

expandMap IDictionary<Type, List<string>>

If provided, will be populated with the names of the expanded properties for each type.

Returns

ICriteria

ApplyExpansions(IQueryable, string, ExpandTypeMap, bool)

Add the Fetch clauses to the query according to the given expand paths

public IQueryable ApplyExpansions(IQueryable queryable, string expandsQueryString, ExpandTypeMap expandMap, bool expandCollections = false)

Parameters

queryable IQueryable

The query to expand

expandsQueryString string

Comma-separated list of properties to expand. May include nested paths of the form "Property/SubProperty"

expandMap ExpandTypeMap

Will be populated with the names of the expanded properties for each type.

expandCollections bool

If true, eagerly fetch collections. Caution: this causes problems with $skip and $top operations.
Default is false. expandMap will still be populated with the collection property, so it will be lazy loaded. Be sure to set default_batch_fetch_size in the configuration for lazy loaded collections.

Returns

IQueryable

ApplyExpansions(IQueryable, string[], ExpandTypeMap, bool)

Add the Fetch clauses to the query according to the given expand paths

public IQueryable ApplyExpansions(IQueryable queryable, string[] expandPaths, ExpandTypeMap expandMap, bool expandCollections = false)

Parameters

queryable IQueryable

The query to expand

expandPaths string[]

The names of the properties to expand. May include nested paths of the form "Property/SubProperty"

expandMap ExpandTypeMap

Will be populated with the names of the expanded properties for each type.

expandCollections bool

If true, eagerly fetch collections. Caution: this causes problems with $skip and $top operations.
Default is false. expandMap will still be populated with the collection property, so it will be lazy loaded. Be sure to set default_batch_fetch_size in the configuration for lazy loaded collections.

Returns

IQueryable

The query with the Fetch clauses applied

MapExpansions(Type, params string[])

Create an ExpandTypeMap populated according to the expandPaths.

public static ExpandTypeMap MapExpansions(Type type, params string[] expandPaths)

Parameters

type Type

The type of the root element.

expandPaths string[]

The names of the properties to expand. May include nested paths of the form "Property/SubProperty"

Returns

ExpandTypeMap

expandMap

MapExpansions(Type, string[], ExpandTypeMap?)

Create an ExpandTypeMap populated according to the expandPaths.

public static ExpandTypeMap MapExpansions(Type type, string[] expandPaths, ExpandTypeMap? expandMap = null)

Parameters

type Type

The type of the root element.

expandPaths string[]

The names of the properties to expand. May include nested paths of the form "Property/SubProperty"

expandMap ExpandTypeMap

Will be populated with the names of the expanded properties for each type. If null, a new one is created.

Returns

ExpandTypeMap

expandMap