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
sessionFactoryISessionFactorySupplies 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
criteriaICriteriaThe query to expand
expandPathsstring[]The names of the properties to expand. May include nested paths of the form "Property/SubProperty"
sessionFactoryISessionFactoryProvides the NHibernate metadata for the classes
expandMapIDictionary<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
queryableIQueryableThe query to expand
expandsQueryStringstringComma-separated list of properties to expand. May include nested paths of the form "Property/SubProperty"
expandMapExpandTypeMapWill be populated with the names of the expanded properties for each type.
expandCollectionsboolIf 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
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
queryableIQueryableThe query to expand
expandPathsstring[]The names of the properties to expand. May include nested paths of the form "Property/SubProperty"
expandMapExpandTypeMapWill be populated with the names of the expanded properties for each type.
expandCollectionsboolIf 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
typeTypeThe type of the root element.
expandPathsstring[]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
typeTypeThe type of the root element.
expandPathsstring[]The names of the properties to expand. May include nested paths of the form "Property/SubProperty"
expandMapExpandTypeMapWill be populated with the names of the expanded properties for each type. If null, a new one is created.
Returns
- ExpandTypeMap
expandMap