C# Class Castle.Facilities.NHibernateIntegration.Components.Dao.NHibernateGenericDao

Summary description for GenericDao.
Contributed by Steve Degosserie <[email protected]>
Show file Open project: hconceicao/Castle.Facilities.NHibernateIntegration3

Public Methods

Method Description
Create ( object instance ) : object

Creates (Saves) a new instance to the database.

CreateStateless ( object instance ) : object

Creates (saves or inserts) a new instance to the database using IStatelessSession.

Delete ( object instance ) : void

Deletes the instance from the database.

DeleteAll ( Type type ) : void

Deletes all rows for the specified type

DeleteAllStateless ( Type type ) : void

Deletes all rows for the specified type using IStatelessSession.

DeleteStateless ( object instance ) : void

Deletes the instance from the database using IStatelessSession.

FindAll ( Type type ) : Array

Returns all instances found for the specified type.

FindAll ( Type type, ICriterion criterias ) : Array

Returns all instances found for the specified type using criteria.

FindAll ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems ) : Array

Returns all instances found for the specified type using criteria.

FindAll ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems, int firstRow, int maxRows ) : Array

Returns all instances found for the specified type using criteria.

FindAll ( Type type, ICriterion criterias, int firstRow, int maxRows ) : Array

Returns all instances found for the specified type using criteria.

FindAll ( Type type, int firstRow, int maxRows ) : Array

Returns a portion of the query results (sliced)

FindAllStateless ( Type type ) : Array

Returns all instances found for the specified type using IStatelessSession.

FindAllStateless ( Type type, ICriterion criterias ) : Array

Returns all instances found for the specified type using criteria and IStatelessSession.

FindAllStateless ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems ) : Array

Returns all instances found for the specified type using criteria and IStatelessSession.

FindAllStateless ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems, int firstRow, int maxRows ) : Array

Returns all instances found for the specified type using criteria and IStatelessSession.

FindAllStateless ( Type type, ICriterion criterias, int firstRow, int maxRows ) : Array

Returns all instances found for the specified type using criteria and IStatelessSession.

FindAllStateless ( Type type, int firstRow, int maxRows ) : Array

Returns a portion of the query results (sliced) using IStatelessSession.

FindAllWithCustomQuery ( string queryString ) : Array

Finds all with custom query.

FindAllWithCustomQuery ( string queryString, int firstRow, int maxRows ) : Array

Finds all with custom HQL query.

FindAllWithCustomQueryStateless ( string queryString ) : Array

Finds all with custom query using IStatelessSession.

FindAllWithCustomQueryStateless ( string queryString, int firstRow, int maxRows ) : Array

Finds all with custom HQL query using IStatelessSession.

FindAllWithNamedQuery ( string namedQuery ) : Array

Finds all with named HQL query.

FindAllWithNamedQuery ( string namedQuery, int firstRow, int maxRows ) : Array

Finds all with named HQL query.

FindAllWithNamedQueryStateless ( string namedQuery ) : Array

Finds all with named HQL query using IStatelessSession.

FindAllWithNamedQueryStateless ( string namedQuery, int firstRow, int maxRows ) : Array

Finds all with named HQL query using IStatelessSession.

FindById ( Type type, object id ) : object

Finds an object instance by an unique ID

FindByIdStateless ( Type type, object id ) : object

Finds an object instance by an unique ID using IStatelessSession.

NHibernateGenericDao ( ISessionManager sessionManager ) : System

Initializes a new instance of the NHibernateGenericDao class.

NHibernateGenericDao ( ISessionManager sessionManager, string sessionFactoryAlias ) : System

Initializes a new instance of the NHibernateGenericDao class.

Save ( object instance ) : void

Saves the instance to the database. If the primary key is unitialized it creates the instance on the database. Otherwise it updates it.

If the primary key is assigned, then you must invoke Create or Update instead.

Update ( object instance ) : void

Persists the modification on the instance state to the database.

UpdateStateless ( object instance ) : void

Persists the modification on the instance state to the database using IStatelessSession.

Private Methods

Method Description
GetSession ( ) : ISession
GetStatelessSession ( ) : IStatelessSession

Method Details

Create() public method

Creates (Saves) a new instance to the database.
public Create ( object instance ) : object
instance object The instance to be created on the database
return object

CreateStateless() public method

Creates (saves or inserts) a new instance to the database using IStatelessSession.
public CreateStateless ( object instance ) : object
instance object The instance to be created on the database
return object

Delete() public method

Deletes the instance from the database.
public Delete ( object instance ) : void
instance object The instance to be deleted from the database
return void

DeleteAll() public method

Deletes all rows for the specified type
public DeleteAll ( Type type ) : void
type System.Type type on which the rows on the database should be deleted
return void

DeleteAllStateless() public method

Deletes all rows for the specified type using IStatelessSession.
public DeleteAllStateless ( Type type ) : void
type System.Type type on which the rows on the database should be deleted
return void

DeleteStateless() public method

Deletes the instance from the database using IStatelessSession.
public DeleteStateless ( object instance ) : void
instance object The instance to be deleted from the database
return void

FindAll() public method

Returns all instances found for the specified type.
public FindAll ( Type type ) : Array
type System.Type The target type.
return System.Array

FindAll() public method

Returns all instances found for the specified type using criteria.
public FindAll ( Type type, ICriterion criterias ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
return System.Array

FindAll() public method

Returns all instances found for the specified type using criteria.
public FindAll ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
sortItems NHibernate.Criterion.Order An of objects.
return System.Array

FindAll() public method

Returns all instances found for the specified type using criteria.
public FindAll ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems, int firstRow, int maxRows ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
sortItems NHibernate.Criterion.Order An of objects.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAll() public method

Returns all instances found for the specified type using criteria.
public FindAll ( Type type, ICriterion criterias, int firstRow, int maxRows ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAll() public method

Returns a portion of the query results (sliced)
public FindAll ( Type type, int firstRow, int maxRows ) : Array
type System.Type The target type.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllStateless() public method

Returns all instances found for the specified type using IStatelessSession.
public FindAllStateless ( Type type ) : Array
type System.Type The target type.
return System.Array

FindAllStateless() public method

Returns all instances found for the specified type using criteria and IStatelessSession.
public FindAllStateless ( Type type, ICriterion criterias ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
return System.Array

FindAllStateless() public method

Returns all instances found for the specified type using criteria and IStatelessSession.
public FindAllStateless ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
sortItems NHibernate.Criterion.Order An of objects.
return System.Array

FindAllStateless() public method

Returns all instances found for the specified type using criteria and IStatelessSession.
public FindAllStateless ( Type type, ICriterion criterias, NHibernate.Criterion.Order sortItems, int firstRow, int maxRows ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
sortItems NHibernate.Criterion.Order An of objects.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllStateless() public method

Returns all instances found for the specified type using criteria and IStatelessSession.
public FindAllStateless ( Type type, ICriterion criterias, int firstRow, int maxRows ) : Array
type System.Type The target type.
criterias ICriterion The criteria expression
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllStateless() public method

Returns a portion of the query results (sliced) using IStatelessSession.
public FindAllStateless ( Type type, int firstRow, int maxRows ) : Array
type System.Type The target type.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllWithCustomQuery() public method

Finds all with custom query.
public FindAllWithCustomQuery ( string queryString ) : Array
queryString string The query string.
return System.Array

FindAllWithCustomQuery() public method

Finds all with custom HQL query.
public FindAllWithCustomQuery ( string queryString, int firstRow, int maxRows ) : Array
queryString string The query string.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllWithCustomQueryStateless() public method

Finds all with custom query using IStatelessSession.
public FindAllWithCustomQueryStateless ( string queryString ) : Array
queryString string The query string.
return System.Array

FindAllWithCustomQueryStateless() public method

Finds all with custom HQL query using IStatelessSession.
public FindAllWithCustomQueryStateless ( string queryString, int firstRow, int maxRows ) : Array
queryString string The query string.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllWithNamedQuery() public method

Finds all with named HQL query.
public FindAllWithNamedQuery ( string namedQuery ) : Array
namedQuery string The named query.
return System.Array

FindAllWithNamedQuery() public method

Finds all with named HQL query.
public FindAllWithNamedQuery ( string namedQuery, int firstRow, int maxRows ) : Array
namedQuery string The named query.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindAllWithNamedQueryStateless() public method

Finds all with named HQL query using IStatelessSession.
public FindAllWithNamedQueryStateless ( string namedQuery ) : Array
namedQuery string The named query.
return System.Array

FindAllWithNamedQueryStateless() public method

Finds all with named HQL query using IStatelessSession.
public FindAllWithNamedQueryStateless ( string namedQuery, int firstRow, int maxRows ) : Array
namedQuery string The named query.
firstRow int The number of the first row to retrieve.
maxRows int The maximum number of results retrieved.
return System.Array

FindById() public method

Finds an object instance by an unique ID
public FindById ( Type type, object id ) : object
type System.Type The AR subclass type
id object ID value
return object

FindByIdStateless() public method

Finds an object instance by an unique ID using IStatelessSession.
public FindByIdStateless ( Type type, object id ) : object
type System.Type The AR subclass type
id object ID value
return object

NHibernateGenericDao() public method

Initializes a new instance of the NHibernateGenericDao class.
public NHibernateGenericDao ( ISessionManager sessionManager ) : System
sessionManager ISessionManager The session manager.
return System

NHibernateGenericDao() public method

Initializes a new instance of the NHibernateGenericDao class.
public NHibernateGenericDao ( ISessionManager sessionManager, string sessionFactoryAlias ) : System
sessionManager ISessionManager The session manager.
sessionFactoryAlias string The session factory alias.
return System

Save() public method

Saves the instance to the database. If the primary key is unitialized it creates the instance on the database. Otherwise it updates it.

If the primary key is assigned, then you must invoke Create or Update instead.

public Save ( object instance ) : void
instance object The instance to be saved
return void

Update() public method

Persists the modification on the instance state to the database.
public Update ( object instance ) : void
instance object The instance to be updated on the database
return void

UpdateStateless() public method

Persists the modification on the instance state to the database using IStatelessSession.
public UpdateStateless ( object instance ) : void
instance object The instance to be updated on the database
return void