|
From: <jul...@us...> - 2010-12-10 14:23:55
|
Revision: 5301
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5301&view=rev
Author: julian-maughan
Date: 2010-12-10 14:23:49 +0000 (Fri, 10 Dec 2010)
Log Message:
-----------
Added BeginTransaction method overload - with IsolationLevel parameter - for stateless sessions (ref. NH-2449)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/IStatelessSession.cs
trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs
Modified: trunk/nhibernate/src/NHibernate/IStatelessSession.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/IStatelessSession.cs 2010-12-09 16:15:38 UTC (rev 5300)
+++ trunk/nhibernate/src/NHibernate/IStatelessSession.cs 2010-12-10 14:23:49 UTC (rev 5301)
@@ -3,8 +3,8 @@
namespace NHibernate
{
- /// <summary>
- /// A command-oriented API for performing bulk operations against a database.
+ /// <summary>
+ /// A command-oriented API for performing bulk operations against a database.
/// </summary>
/// <remarks>
/// A stateless session does not implement a first-level cache nor
@@ -17,7 +17,7 @@
/// aliasing effects, due to the lack of a first-level cache.
/// <para/>
/// For certain kinds of transactions, a stateless session may
- /// perform slightly faster than a stateful session.
+ /// perform slightly faster than a stateful session.
/// </remarks>
public interface IStatelessSession : IDisposable
{
@@ -61,46 +61,46 @@
object Get(string entityName, object id);
/// <summary> Retrieve a entity.
- ///
+ ///
/// </summary>
/// <returns> a detached entity instance
/// </returns>
T Get<T>(object id);
- /// <summary>
- /// Retrieve a entity, obtaining the specified lock mode.
+ /// <summary>
+ /// Retrieve a entity, obtaining the specified lock mode.
/// </summary>
/// <returns> a detached entity instance </returns>
object Get(string entityName, object id, LockMode lockMode);
- /// <summary>
- /// Retrieve a entity, obtaining the specified lock mode.
+ /// <summary>
+ /// Retrieve a entity, obtaining the specified lock mode.
/// </summary>
/// <returns> a detached entity instance </returns>
T Get<T>(object id, LockMode lockMode);
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entity">The entity to be refreshed. </param>
void Refresh(object entity);
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entityName">The entityName for the entity to be refreshed. </param>
/// <param name="entity">The entity to be refreshed.</param>
void Refresh(string entityName, object entity);
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entity">The entity to be refreshed. </param>
/// <param name="lockMode">The LockMode to be applied.</param>
void Refresh(object entity, LockMode lockMode);
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entityName">The entityName for the entity to be refreshed. </param>
/// <param name="entity">The entity to be refreshed. </param>
@@ -113,7 +113,7 @@
/// <remarks>Entities returned by the query are detached.</remarks>
IQuery CreateQuery(string queryString);
- /// <summary>
+ /// <summary>
/// Obtain an instance of <see cref="IQuery"/> for a named query string defined in
/// the mapping file.
/// </summary>
@@ -125,7 +125,7 @@
/// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity class,
- /// or a superclass of an entity class.
+ /// or a superclass of an entity class.
/// </summary>
/// <typeparam name="T">A class, which is persistent, or has persistent subclasses</typeparam>
/// <returns> The <see cref="ICriteria"/>. </returns>
@@ -134,7 +134,7 @@
/// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity class,
- /// or a superclass of an entity class, with the given alias.
+ /// or a superclass of an entity class, with the given alias.
/// </summary>
/// <typeparam name="T">A class, which is persistent, or has persistent subclasses</typeparam>
/// <param name="alias">The alias of the entity</param>
@@ -144,7 +144,7 @@
/// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity class,
- /// or a superclass of an entity class.
+ /// or a superclass of an entity class.
/// </summary>
/// <param name="entityType">A class, which is persistent, or has persistent subclasses</param>
/// <returns> The <see cref="ICriteria"/>. </returns>
@@ -153,7 +153,7 @@
/// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity class,
- /// or a superclass of an entity class, with the given alias.
+ /// or a superclass of an entity class, with the given alias.
/// </summary>
/// <param name="entityType">A class, which is persistent, or has persistent subclasses</param>
/// <param name="alias">The alias of the entity</param>
@@ -161,7 +161,7 @@
/// <remarks>Entities returned by the query are detached.</remarks>
ICriteria CreateCriteria(System.Type entityType, string alias);
- /// <summary>
+ /// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity name.
/// </summary>
/// <param name="entityName">The entity name. </param>
@@ -169,9 +169,9 @@
/// <remarks>Entities returned by the query are detached.</remarks>
ICriteria CreateCriteria(string entityName);
- /// <summary>
+ /// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity name,
- /// with the given alias.
+ /// with the given alias.
/// </summary>
/// <param name="entityName">The entity name. </param>
/// <param name="alias">The alias of the entity</param>
@@ -179,7 +179,7 @@
/// <remarks>Entities returned by the query are detached.</remarks>
ICriteria CreateCriteria(string entityName, string alias);
- /// <summary>
+ /// <summary>
/// Create a new instance of <see cref="ISQLQuery"/> for the given SQL query string.
/// Entities returned by the query are detached.
/// </summary>
@@ -187,10 +187,20 @@
/// <returns> The <see cref="ISQLQuery"/> </returns>
ISQLQuery CreateSQLQuery(string queryString);
- /// <summary> Begin a NHibernate transaction.</summary>
+ /// <summary>
+ /// Begin a NHibernate transaction
+ /// </summary>
+ /// <returns>A NHibernate transaction</returns>
ITransaction BeginTransaction();
- /// <summary>
+ /// <summary>
+ /// Begin a NHibernate transaction with the specified isolation level
+ /// </summary>
+ /// <param name="isolationLevel">The isolation level</param>
+ /// <returns>A NHibernate transaction</returns>
+ ITransaction BeginTransaction(IsolationLevel isolationLevel);
+
+ /// <summary>
/// Returns the current ADO.NET connection associated with this instance.
/// </summary>
/// <remarks>
Modified: trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs 2010-12-09 16:15:38 UTC (rev 5300)
+++ trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs 2010-12-10 14:23:49 UTC (rev 5301)
@@ -140,15 +140,15 @@
}
}
- public override IList List(IQueryExpression queryExpression, QueryParameters parameters)
- {
- throw new System.NotImplementedException();
- }
+ public override IList List(IQueryExpression queryExpression, QueryParameters parameters)
+ {
+ throw new System.NotImplementedException();
+ }
- public override void List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
- {
- throw new System.NotImplementedException();
- }
+ public override void List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
+ {
+ throw new System.NotImplementedException();
+ }
public override IList<T> List<T>(string query, QueryParameters queryParameters)
{
@@ -660,7 +660,7 @@
}
/// <summary> Retrieve a entity.
- ///
+ ///
/// </summary>
/// <returns> a detached entity instance
/// </returns>
@@ -680,8 +680,8 @@
}
}
- /// <summary>
- /// Retrieve a entity, obtaining the specified lock mode.
+ /// <summary>
+ /// Retrieve a entity, obtaining the specified lock mode.
/// </summary>
/// <returns> a detached entity instance </returns>
public object Get(string entityName, object id, LockMode lockMode)
@@ -695,8 +695,8 @@
}
}
- /// <summary>
- /// Retrieve a entity, obtaining the specified lock mode.
+ /// <summary>
+ /// Retrieve a entity, obtaining the specified lock mode.
/// </summary>
/// <returns> a detached entity instance </returns>
public T Get<T>(object id, LockMode lockMode)
@@ -707,8 +707,8 @@
}
}
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entity">The entity to be refreshed. </param>
public void Refresh(object entity)
@@ -719,8 +719,8 @@
}
}
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entityName">The entityName for the entity to be refreshed. </param>
/// <param name="entity">The entity to be refreshed.</param>
@@ -732,8 +732,8 @@
}
}
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entity">The entity to be refreshed. </param>
/// <param name="lockMode">The LockMode to be applied.</param>
@@ -745,8 +745,8 @@
}
}
- /// <summary>
- /// Refresh the entity instance state from the database.
+ /// <summary>
+ /// Refresh the entity instance state from the database.
/// </summary>
/// <param name="entityName">The entityName for the entity to be refreshed. </param>
/// <param name="entity">The entity to be refreshed. </param>
@@ -794,7 +794,7 @@
/// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity class,
- /// or a superclass of an entity class.
+ /// or a superclass of an entity class.
/// </summary>
/// <typeparam name="T">A class, which is persistent, or has persistent subclasses</typeparam>
/// <returns> The <see cref="ICriteria"/>. </returns>
@@ -809,7 +809,7 @@
/// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity class,
- /// or a superclass of an entity class, with the given alias.
+ /// or a superclass of an entity class, with the given alias.
/// </summary>
/// <typeparam name="T">A class, which is persistent, or has persistent subclasses</typeparam>
/// <param name="alias">The alias of the entity</param>
@@ -841,7 +841,7 @@
}
}
- /// <summary>
+ /// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity name.
/// </summary>
/// <param name="entityName">The entity name. </param>
@@ -856,9 +856,9 @@
}
}
- /// <summary>
+ /// <summary>
/// Create a new <see cref="ICriteria"/> instance, for the given entity name,
- /// with the given alias.
+ /// with the given alias.
/// </summary>
/// <param name="entityName">The entity name. </param>
/// <param name="alias">The alias of the entity</param>
@@ -873,13 +873,26 @@
}
}
- /// <summary> Begin a NHibernate transaction.</summary>
+ /// <summary>
+ /// Begin a NHibernate transaction
+ /// </summary>
+ /// <returns>A NHibernate transaction</returns>
public ITransaction BeginTransaction()
{
+ return BeginTransaction(IsolationLevel.Unspecified);
+ }
+
+ /// <summary>
+ /// Begin a NHibernate transaction with the specified isolation level
+ /// </summary>
+ /// <param name="isolationLevel">The isolation level</param>
+ /// <returns>A NHibernate transaction</returns>
+ public ITransaction BeginTransaction(IsolationLevel isolationLevel)
+ {
using (new SessionIdLoggingContext(SessionId))
{
CheckAndUpdateSessionStatus();
- return connectionManager.BeginTransaction();
+ return connectionManager.BeginTransaction(isolationLevel);
}
}
@@ -1011,8 +1024,7 @@
}
else
{
- return Factory.GetEntityPersister(entityName).GetSubclassEntityPersister(obj, Factory,
- EntityMode.Poco);
+ return Factory.GetEntityPersister(entityName).GetSubclassEntityPersister(obj, Factory, EntityMode.Poco);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|