The ISession type exposes the following members.

Methods

  NameDescription
Public methodBeginTransaction()()()()
Begin a unit of work and return the associated ITransaction object.
Public methodBeginTransaction(IsolationLevel)
Begin a transaction with the specified isolationLevel
Public methodCancelQuery
Cancel execution of the current query.
Public methodClear
Completely clear the session. Evict all loaded instances and cancel all pending saves, updates and deletions. Do not close open enumerables or instances of ScrollableResults.
Public methodClose
End the ISession by disconnecting from the ADO.NET connection and cleaning up.
Public methodContains
Is this instance associated with this Session?
Public methodCreateCriteria(String)
Create a new Criteria instance, for the given entity name.
Public methodCreateCriteria(Type)
Creates a new Criteria for the entity class.
Public methodCreateCriteria(String, String)
Create a new Criteria instance, for the given entity name, with the given alias.
Public methodCreateCriteria(Type, String)
Creates a new Criteria for the entity class with a specific alias
Public methodCreateCriteria<(Of <<'(T>)>>)()()()()
Creates a new Criteria for the entity class.
Public methodCreateCriteria<(Of <<'(T>)>>)(String)
Creates a new Criteria for the entity class with a specific alias
Public methodCreateFilter
Create a new instance of Query for the given collection and filter string
Public methodCreateMultiCriteria
An IMultiCriteria that can return a list of all the results of all the criterias.
Public methodCreateMultiQuery
Create a multi query, a query that can send several queries to the server, and return all their results in a single call.
Public methodCreateQuery
Create a new instance of Query for the given query string
Public methodCreateSQLQuery
Create a new instance of ISQLQuery for the given SQL query string.
Public methodDelete(Object)
Remove a persistent instance from the datastore.
Public methodDelete(String)
Delete all objects returned by the query.
Public methodDelete(String, Object)
Remove a persistent instance from the datastore. The object argument may be an instance associated with the receiving ISession or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped with cascade="delete".
Public methodDelete(String, Object, IType)
Delete all objects returned by the query.
Public methodDelete(String, array<Object>[]()[][], array<IType>[]()[][])
Delete all objects returned by the query.
Public methodDisableFilter
Disable the named filter for the current session.
Public methodDisconnect
Disconnect the ISession from the current ADO.NET connection.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodEnableFilter
Enable the named filter for this current session.
Public methodEvict
Remove this instance from the session cache.
Public methodFlush
Force the ISession to flush.
Public methodGet(String, Object)
Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance. (If the instance, or a proxy for the instance, is already associated with the session, return that instance or proxy.)
Public methodGet(Type, Object)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance, or a proxy for the instance, is already associated with the session, return that instance or proxy.)
Public methodGet(Type, Object, LockMode)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. Obtain the specified lock mode if the instance exists.
Public methodGet<(Of <<'(T>)>>)(Object)
Strongly-typed version of Get(Type, Object)
Public methodGet<(Of <<'(T>)>>)(Object, LockMode)
Strongly-typed version of Get(Type, Object, LockMode)
Public methodGetCurrentLockMode
Determine the current lock mode of the given object
Public methodGetEnabledFilter
Retrieve a currently enabled filter by name.
Public methodGetEntityName
Return the entity name for a persistent entity
Public methodGetIdentifier
Return the identifier of an entity instance cached by the ISession
Public methodGetNamedQuery
Obtain an instance of IQuery for a named query string defined in the mapping file.
Public methodGetSession
Starts a new Session with the given entity mode in effect. This secondary Session inherits the connection, transaction, and other context information from the primary Session. It doesn't need to be flushed or closed by the developer.
Public methodGetSessionImplementation
Gets the session implementation.
Public methodIsDirty
Does this ISession contain any changes which must be synchronized with the database? Would any SQL be executed if we flushed this session?
Public methodIsReadOnly
Is the specified entity (or proxy) read-only?
Public methodLoad(Object, Object)
Read the persistent state associated with the given identifier into the given transient instance.
Public methodLoad(String, Object)
Return the persistent instance of the given entityName with the given identifier, assuming that the instance exists.
Public methodLoad(Type, Object)
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
Public methodLoad(String, Object, LockMode)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
Public methodLoad(Type, Object, LockMode)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode.
Public methodLoad<(Of <<'(T>)>>)(Object)
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
Public methodLoad<(Of <<'(T>)>>)(Object, LockMode)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode.
Public methodLock(Object, LockMode)
Obtain the specified lock level upon the given object.
Public methodLock(String, Object, LockMode)
Obtain the specified lock level upon the given object.
Public methodMerge(Object)
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge".
The semantics of this method are defined by JSR-220.
Public methodMerge(String, Object)
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge".
The semantics of this method are defined by JSR-220. Name of the entity.a detached instance with state to be copied

Return Value

an updated persistent instance
Public methodMerge<(Of <<'(T>)>>)(T)
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge".
The semantics of this method are defined by JSR-220.
Public methodMerge<(Of <<'(T>)>>)(String, T)
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge".
The semantics of this method are defined by JSR-220. Name of the entity.a detached instance with state to be copied

Return Value

an updated persistent instance
Public methodPersist(Object)
Make a transient instance persistent. This operation cascades to associated instances if the association is mapped with cascade="persist".
The semantics of this method are defined by JSR-220.
Public methodPersist(String, Object)
Make a transient instance persistent. This operation cascades to associated instances if the association is mapped with cascade="persist".
The semantics of this method are defined by JSR-220.
Public methodQueryOver<(Of <<'(T>)>>)()()()()
Creates a new IQueryOver<T> for the entity class.
Public methodQueryOver<(Of <<'(T>)>>)(Expression<(Of <<'(Func<(Of <<'(T>)>>)>)>>))
Creates a new IQueryOver<T> for the entity class.
Public methodQueryOver<(Of <<'(T>)>>)(String)
Creates a new IQueryOver{T}; for the entity class.
Public methodQueryOver<(Of <<'(T>)>>)(String, Expression<(Of <<'(Func<(Of <<'(T>)>>)>)>>))
Creates a new IQueryOver{T} for the entity class.
Public methodReconnect()()()()
Obtain a new ADO.NET connection.
Public methodReconnect(IDbConnection)
Reconnect to the given ADO.NET connection.
Public methodRefresh(Object)
Re-read the state of the given instance from the underlying database.
Public methodRefresh(Object, LockMode)
Re-read the state of the given instance from the underlying database, with the given LockMode.
Public methodReplicate(Object, ReplicationMode)
Persist all reachable transient objects, reusing the current identifier values. Note that this will not trigger the Interceptor of the Session.
Public methodReplicate(String, Object, ReplicationMode)
Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped with cascade="replicate".
Public methodSave(Object)
Persist the given transient instance, first assigning a generated identifier.
Public methodSave(Object, Object)
Persist the given transient instance, using the given identifier.
Public methodSave(String, Object)
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.)
Public methodSaveOrUpdate(Object)
Either Save() or Update() the given instance, depending upon the value of its identifier property.
Public methodSaveOrUpdate(String, Object)
Either Save(String, Object) or Update(String, Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).
Public methodSaveOrUpdateCopy(Object) Obsolete.
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved or does not exist in the database, save it and return it as a newly persistent instance. Otherwise, the given instance does not become associated with the session.
Public methodSaveOrUpdateCopy(Object, Object) Obsolete.
Copy the state of the given object onto the persistent object with the given identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If there is no database row with the given identifier, save the given instance and return it as a newly persistent instance. Otherwise, the given instance does not become associated with the session.
Public methodSetBatchSize
Sets the batch size of the session
Public methodSetReadOnly
Change the read-only status of an entity (or proxy).
Public methodUpdate(Object)
Update the persistent instance with the identifier of the given transient instance.
Public methodUpdate(Object, Object)
Update the persistent state associated with the given identifier.
Public methodUpdate(String, Object)
Update the persistent instance with the identifier of the given detached instance.

Extension Methods

  NameDescription
Public Extension MethodQuery<(Of <<'(T>)>>) (Defined by LinqExtensionMethods.)

Properties

  NameDescription
Public propertyActiveEntityMode
The entity mode in effect for this session.
Public propertyCacheMode
The current cache mode.
Public propertyConnection
Gets the ADO.NET connection.
Public propertyDefaultReadOnly
The read-only status for entities (and proxies) loaded into this Session.
Public propertyFlushMode
Determines at which points Hibernate automatically flushes the session.
Public propertyIsConnected
Is the ISession currently connected?
Public propertyIsOpen
Is the ISession still open?
Public propertySessionFactory
Get the ISessionFactory that created this instance.
Public propertyStatistics
Get the statistics for this session.
Public propertyTransaction
Get the current Unit of Work and return the associated ITransaction object.

See Also