Table of Contents

Namespace Breeze.Persistence.NH

Classes

ExcludingContractResolver

Newtonsoft.Json ContractResolver that can be configured to exclude certain properties by name. Allows JSON serializer to skip certain properties, thus preventing the serializer from trying to serialize the entire object graph.

ExpandTypeMap

Keeps track of the types and methods used by a query, so it can control the lazy loaded in the JsonFormatter.

IncludingContractResolver

Newtonsoft.Json ContractResolver that can be configured to include properties by name. Allows JSON serializer to skip certain properties, thus preventing the serializer from trying to serialize the entire object graph. Serializes value types and System types by default, but excludes all collections and other types unless explicitly included.

NHBreezeMetadata

Metadata describing the entity model. Converted to JSON to send to Breeze client.

NHEagerFetch

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

NHExpander

Initializes Hibernate proxies and collections prior to serialization. This is used to implement the OData $expand operation.

Be sure to set the default_batch_fetch_size property in your NH config file (or Web.config), e.g.

<property name="default_batch_fetch_size">32</property>

so that lazy loading happens in batches, instead of one at a time.

NHIncludingContractResolver

Newtonsoft.Json ContractResolver that can be configured to include properties by name. Allows JSON serializer to skip certain properties, thus preventing the serializer from trying to serialize the entire object graph. Uses the ClassMetaData from the SessionFactory to determine which types should be serialized by default. Excludes association properties by default, unless explicitly included.

NHInitializer

Forces NHibernate lazy proxies to load, so that expanded entities are present before the session closes and the results are serialized.

NHMetadataBuilder

Builds a data structure containing the metadata required by Breeze. Breeze metadata schema

NHPersistenceManager

Manage persistence for NHibernate entity models

NHQueryHelper

Query helpers for NHibernate: an Include operator, and the hooks Breeze calls around query execution.

NHQueryProvider

An NHibernate query provider that also carries the Include paths for a query, since they cannot be put in the expression tree.

NHRelationshipFixer
Utility class for re-establishing the relationships between entities prior to saving them in Nhibernate.

Breeze requires many-to-one relationships to have properties both the related entity and its ID, and it 
sends only the ID in the save bundle.  To make it work with NH, we map the 
many-to-one

entity, and map the foreign key ID with

insert="false" update="false"

, so the

many-to-one

entity must be populated in order for the foreign key value to be saved in the DB. To work around this problem, this class uses the IDs sent by Breeze to re-connect the related entities.

NHTransactionWrapper

Presents an NHibernate ITransaction as an IDbTransaction, which is what the save pipeline in PersistenceManager works with.

NHibernateContractResolver

Newtonsoft.Json ContractResolver for NHibernate objects. Allows JSON serializer to skip properties that are not already resolved, thus preventing the serializer from trying to serialize the entire object graph. Code copied from https://github.com/PeteGoo/NHibernate.QueryService

NHibernateProxyJsonConverter

JsonConverter for handling NHibernate proxies.
Only serializes the object if it is initialized, i.e. the proxied object has been loaded.

NhQueryableInclude<T>

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.

TypeContractResolver

Newtonsoft.Json ContractResolver that only includes certain types from a given assembly. All other types from that assembly are excluded. This allows control over which custom types are serialized.

Interfaces

IQueryableInclude

A query that carries Include paths, so a caller can read them back without knowing the element type.