Author: gbayon
Date: Tue Oct 10 11:57:36 2006
New Revision: 462499

URL: http://svn.apache.org/viewvc?view=rev&rev=462499
Log:
Fixed IBATISNET-185 

Added:
    ibatis/trunk/cs/mapper/IBatisNet.2003.sln
      - copied unchanged from r454428, ibatis/trunk/cs/mapper/IBatisNet.sln
    
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs
   (with props)
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs
   (with props)
Removed:
    ibatis/trunk/cs/mapper/IBatisNet.sln
Modified:
    
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.2005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IDaoManager.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/AbstractSessionStore.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/CallContextSessionStore.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/WebSessionStore.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ISqlMapper.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
 Tue Oct 10 11:57:36 2006
@@ -482,9 +482,9 @@
 
                                // name
                                attribute = contextNode.Attributes["id"];
-                               daoManager.Name = attribute.Value;
+                daoManager.Id = attribute.Value;
 
-                               configurationScope.ErrorContext.Activity += 
daoManager.Name;
+                configurationScope.ErrorContext.Activity += daoManager.Id;
 
                                // default
                                attribute = contextNode.Attributes["default"];
@@ -586,9 +586,9 @@
                                #region Register DaoManager
 
                                configurationScope.ErrorContext.MoreInfo = 
"register DaoManager";
-                               configurationScope.ErrorContext.ObjectId = 
daoManager.Name;
+                configurationScope.ErrorContext.ObjectId = daoManager.Id;
 
-                               DaoManager.RegisterDaoManager(daoManager.Name, 
daoManager);
+                DaoManager.RegisterDaoManager(daoManager.Id, daoManager);
 
                                configurationScope.ErrorContext.Resource = 
string.Empty;
                                configurationScope.ErrorContext.MoreInfo = 
string.Empty;

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs Tue Oct 10 
11:57:36 2006
@@ -122,14 +122,28 @@
                /// <summary>
                /// Container session unique for each 'thread'. 
                /// </summary>
-               private ISessionStore _sessionHolder = null;
+               private ISessionStore _sessionStore = null;
                #endregion
 
                #region Properties
 
-               /// <summary>
-               /// 
-               /// </summary>
+        /// <summary>
+        /// Allow to set a custom session store like the <see 
cref="HybridWebThreadSessionStore"/>
+        /// </summary>
+        /// <remarks>Set it after the configuration and before use of the <see 
cref="IDaoManager"/></remarks>
+        /// <example>
+        /// daoManager.SessionStore = new HybridWebThreadSessionStore( 
daoManager.Id );
+        /// </example>
+        public ISessionStore SessionStore
+        {
+            set { _sessionStore = value; }
+        }
+
+
+        /// <summary>
+        /// Gets or sets the data source.
+        /// </summary>
+        /// <value>The data source.</value>
                internal IDataSource DataSource
                {
                        get { return _dataSource; }
@@ -155,9 +169,9 @@
                }
 
                /// <summary>
-               /// DaoManger name
+               /// DaoManager name
                /// </summary>
-               internal string Name
+               public string Id
                {
                        get { return _name; }
                        set { _name = value; }
@@ -198,11 +212,11 @@
                {
                        get 
                        { 
-                               if (_sessionHolder.LocalSession == null) 
+                               if (_sessionStore.LocalSession == null) 
                                {
                                        throw new 
DataAccessException("DaoManager could not invoke LocalDaoSession. No DaoSession 
was started. Call OpenConnection() or BeginTransaction first.");
                                }
-                               return _sessionHolder.LocalSession;
+                               return _sessionStore.LocalSession;
                        }
                }
 
@@ -215,7 +229,7 @@
                /// </summary>
                private DaoManager() 
                {
-            _sessionHolder = SessionStoreFactory.GetSessionStore(this.Name);
+            _sessionStore = SessionStoreFactory.GetSessionStore(this.Id);
                }
                #endregion
 
@@ -393,7 +407,7 @@
         /// </returns>
                public bool IsDaoSessionStarted()
                {
-                       return (_sessionHolder.LocalSession != null);
+                       return (_sessionStore.LocalSession != null);
                }
 
                /// <summary>
@@ -406,12 +420,12 @@
                        {
                                throw new DataAccessException("DaoManager could 
not get DaoSession.  DaoSessionPool was null (possibly not configured).");
                        }
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke OpenConnection(). A connection is already started. Call 
CloseConnection first.");
                        }
                        IDalSession session = 
_daoSessionHandler.GetDaoSession(this);
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.OpenConnection();
                        return session;
                }
@@ -426,12 +440,12 @@
                        {
                                throw new DataAccessException("DaoManager could 
not get DaoSession.  DaoSessionPool was null (possibly not configured).");
                        }
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke OpenConnection(). A connection is already started. Call 
CloseConnection first.");
                        }
                        IDalSession session = 
_daoSessionHandler.GetDaoSession(this);
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.OpenConnection(connectionString);
                        return session; 
 
@@ -442,13 +456,13 @@
                /// </summary>
                public void CloseConnection()
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke CloseConnection(). No connection was started. Call OpenConnection() 
first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.CloseConnection();      
                        } 
                        catch(Exception ex)
@@ -457,7 +471,7 @@
                        }
                        finally 
                        {
-                               _sessionHolder.Dispose();
+                               _sessionStore.Dispose();
                        }
                }
 
@@ -471,12 +485,12 @@
                        {
                                throw new DataAccessException("DaoManager could 
not get DaoSession.  DaoSessionPool was null (possibly not configured).");
                        }
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke BeginTransaction(). A DaoSession is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
                        IDalSession session = 
_daoSessionHandler.GetDaoSession(this);
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.BeginTransaction();
                        return session;
                }
@@ -494,13 +508,13 @@
                        {
                                throw new DataAccessException("DaoManager could 
not get DaoSession.  DaoSessionPool was null (possibly not configured).");
                        }
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke BeginTransaction(). A DaoSession is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
 
                        IDalSession session = 
_daoSessionHandler.GetDaoSession(this);
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.BeginTransaction(isolationLevel);
                        return session;
                }
@@ -513,18 +527,18 @@
                /// </remarks>
                public void CommitTransaction()
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke CommitTransaction(). No Transaction was started. Call 
BeginTransaction() first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.CommitTransaction();
                        } 
                        finally 
                        {
-                               _sessionHolder.Dispose();
+                               _sessionStore.Dispose();
                        }
                }
 
@@ -536,18 +550,18 @@
                /// </remarks>
                public void RollBackTransaction()
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataAccessException("DaoManager could 
not invoke RollBackTransaction(). No Transaction was started. Call 
BeginTransaction() first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.RollBackTransaction();  
                        } 
                        finally 
                        {
-                               _sessionHolder.Dispose();
+                               _sessionStore.Dispose();
                        }
                }
 
@@ -557,7 +571,7 @@
                /// <remarks>Use in SqlMapDaoSession</remarks>
                internal void Dispose()
                {
-                       _sessionHolder.Dispose();
+                       _sessionStore.Dispose();
                }
 
                #endregion

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.2005.csproj
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.2005.csproj?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.2005.csproj 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.2005.csproj 
Tue Oct 10 11:57:36 2006
@@ -150,6 +150,7 @@
     </Compile>
     <Compile Include="SessionStore\AbstractSessionStore.cs" />
     <Compile Include="SessionStore\CallContextSessionStore.cs" />
+    <Compile Include="SessionStore\HybridWebThreadSessionStore.cs" />
     <Compile Include="SessionStore\ISessionStore.cs" />
     <Compile Include="SessionStore\SessionStoreFactory .cs" />
     <Compile Include="SessionStore\WebSessionStore.cs" />

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IBatisNet.DataAccess.csproj Tue 
Oct 10 11:57:36 2006
@@ -245,6 +245,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "SessionStore\HybridWebThreadSessionStore.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "SessionStore\ISessionStore.cs"
                     SubType = "Code"
                     BuildAction = "Compile"

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IDaoManager.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IDaoManager.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IDaoManager.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataAccess/IDaoManager.cs Tue Oct 10 
11:57:36 2006
@@ -28,6 +28,7 @@
 
 using IBatisNet.Common;
 using IBatisNet.DataAccess.Interfaces;
+using IBatisNet.DataAccess.SessionStore;
 
 namespace IBatisNet.DataAccess
 {
@@ -36,6 +37,20 @@
     /// </summary>
     public interface IDaoManager
     {
+        /// <summary>
+        /// Name used to identify the the <see cref="IDaoManager"/>
+        /// </summary>
+        string Id { get;set; }
+
+        /// <summary>
+        /// Allow to set a custom session store like the <see 
cref="HybridWebThreadSessionStore"/>
+        /// </summary>
+        /// <remarks>Set it after the configuration and before use of the <see 
cref="IDaoManager"/></remarks>
+        /// <example>
+        /// daoManager.SessionStore = new HybridWebThreadSessionStore( 
daoManager.Id );
+        /// </example>
+        ISessionStore SessionStore { set; }
+        
         /// <summary>
         /// Begins a database transaction with the specified isolation level.
         /// </summary>

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/AbstractSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/AbstractSessionStore.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/AbstractSessionStore.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/AbstractSessionStore.cs
 Tue Oct 10 11:57:36 2006
@@ -42,10 +42,10 @@
                /// <summary>
                /// Constructor
                /// </summary>
-               /// <param name="daoManagerName">The DaoManager name.</param>
-               public AbstractSessionStore(string daoManagerName)
+        /// <param name="daoManagerId">The DaoManager name.</param>
+        public AbstractSessionStore(string daoManagerId)
                {
-            sessionName = KEY + daoManagerName;
+            sessionName = KEY + daoManagerId;
                }
 
                /// <summary>

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/CallContextSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/CallContextSessionStore.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/CallContextSessionStore.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/CallContextSessionStore.cs
 Tue Oct 10 11:57:36 2006
@@ -31,14 +31,16 @@
        /// <summary>
        /// Provides an implementation of <see cref="ISessionStore"/>
        /// which relies on <c>CallContext</c>
+    /// This implementation will first get the current session from the 
current 
+    /// thread. Do NOT use on web scenario (web applications or web services).
        /// </summary>
        public class CallContextSessionStore : AbstractSessionStore
        {
         /// <summary>
         /// Initializes a new instance of the <see 
cref="CallContextSessionStore"/> class.
         /// </summary>
-        /// <param name="daoManagerName">The DaoManager name.</param>
-               public CallContextSessionStore(string daoManagerName) : 
base(daoManagerName)
+        /// <param name="daoManagerId">The DaoManager name.</param>
+        public CallContextSessionStore(string daoManagerId) : 
base(daoManagerId)
                {}
 
                /// <summary>

Added: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs?view=auto&rev=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs
 (added)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs
 Tue Oct 10 11:57:36 2006
@@ -0,0 +1,102 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 378715 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006 - Apache Fondation
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ 
********************************************************************************/
+#endregion
+
+using System.Runtime.Remoting.Messaging;
+using System.Web;
+using IBatisNet.Common;
+
+namespace IBatisNet.DataAccess.SessionStore
+{
+    /// <summary>
+    /// This implementation of <see cref="ISessionStore"/>will first try 
+    /// to get the currentrequest, and if not found, will use a thread local.
+    /// </summary>
+    /// <remarks>
+    /// This is used for scenarios where most of the you need per request 
session, but you also does some work outside a 
+    /// request (in a thread pool thread, for instance).
+    /// </remarks>
+    public class HybridWebThreadSessionStore : AbstractSessionStore
+    {
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="WebSessionStore"/> 
class.
+        /// </summary>
+        /// <param name="daoManagerId">The DaoManager name.</param>
+        public HybridWebThreadSessionStore(string daoManagerId) : 
base(daoManagerId)
+        { }
+
+        /// <summary>
+        /// Get the local session
+        /// </summary>
+        public override IDalSession LocalSession
+        {
+            get
+            {
+                HttpContext currentContext = HttpContext.Current;
+                if (currentContext == null)
+                {
+                    return CallContext.GetData(sessionName) as IDalSession;
+                }
+                return currentContext.Items[sessionName] as IDalSession;
+            }
+        }
+
+        /// <summary>
+        /// Store the specified session.
+        /// </summary>
+        /// <param name="session">The session to store</param>
+        public override void Store(IDalSession session)
+        {
+            HttpContext currentContext = HttpContext.Current;
+            if (currentContext == null)
+            {
+                CallContext.SetData(sessionName, session);
+            }
+            else
+            {
+                currentContext.Items[sessionName] = session;
+            }
+        }
+
+        /// <summary>
+        /// Remove the local session.
+        /// </summary>
+        public override void Dispose()
+        {
+            HttpContext currentContext = HttpContext.Current;
+            if (currentContext == null)
+            {
+                CallContext.SetData(sessionName, null);
+            }
+            else
+            {
+                currentContext.Items[sessionName] = null;
+            }
+        }
+
+
+    }
+}

Propchange: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/HybridWebThreadSessionStore.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/WebSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/WebSessionStore.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/WebSessionStore.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataAccess/SessionStore/WebSessionStore.cs 
Tue Oct 10 11:57:36 2006
@@ -39,8 +39,8 @@
         /// <summary>
         /// Initializes a new instance of the <see cref="WebSessionStore"/> 
class.
         /// </summary>
-        /// <param name="daoManagerName">The DaoManager name.</param>
-               public WebSessionStore(string 
daoManagerName):base(daoManagerName)
+        /// <param name="daoManagerId">The DaoManager name.</param>
+        public WebSessionStore(string daoManagerId) : base(daoManagerId)
                {}
 
                /// <summary>

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
 Tue Oct 10 11:57:36 2006
@@ -6,6 +6,8 @@
 using IBatisNet.Common.Utilities;
 using IBatisNet.DataMapper; // SqlMap API
 using IBatisNet.DataMapper.Configuration;
+using IBatisNet.DataMapper.SessionStore;
+using IBatisNet.DataMapper.Test.Domain;
 using NUnit.Framework;
 using System.Collections.Specialized;
 
@@ -35,6 +37,19 @@
 
         }
                #endregion 
+           
+           /// <summary>
+        /// Test HybridWebThreadSessionStore
+        /// </summary>
+        [Test]
+        public void HybridWebThreadSessionStoreTest()
+           {
+            sqlMap.SessionStore = new HybridWebThreadSessionStore(sqlMap.Id);
+               
+            Account account = sqlMap.QueryForObject("SelectWithProperty", 
null) as Account;
+            AssertAccount1(account);
+           }
+           
 
                #region Relatives Path tests
 

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
 Tue Oct 10 11:57:36 2006
@@ -164,12 +164,10 @@
                }
 
         /// <summary>
-        /// Test resultMap with a result property using another resultMap and 
where
-        /// - the result property resultMap use a constructor
-        /// - all the constructor arguments are null.
+        /// Test a constructor argument with select tag.
         /// </remarks>
         [Test]
-        public void TestJIRAXXX()
+        public void TestJIRA186()
         {
             Order order = sqlMap.QueryForObject("GetOrderConstructor10", 5) as 
Order;
 

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt Tue Oct 10 
11:57:36 2006
@@ -8,6 +8,7 @@
  - IBATISNET-184 : Invalid support for public/protected field in result 
property
 
 Improvements/Changes
+- IBATISNET-185  : Allow custom ISessionStore
 - IBATISNET-180 : Extends use of ISqlMapper in DataMapper + allow use of a 
custom ISqlMapper
 
 ------------------------------

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj 
Tue Oct 10 11:57:36 2006
@@ -548,6 +548,7 @@
     </Compile>
     <Compile Include="SessionStore\AbstractSessionStore.cs" />
     <Compile Include="SessionStore\CallContextSessionStore.cs" />
+    <Compile Include="SessionStore\HybridWebThreadSessionStore.cs" />
     <Compile Include="SessionStore\ISessionStore.cs" />
     <Compile Include="SessionStore\SessionStoreFactory .cs" />
     <Compile Include="SessionStore\WebSessionStore.cs" />

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj Tue 
Oct 10 11:57:36 2006
@@ -1103,6 +1103,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "SessionStore\HybridWebThreadSessionStore.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "SessionStore\ISessionStore.cs"
                     SubType = "Code"
                     BuildAction = "Compile"

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ISqlMapper.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ISqlMapper.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ISqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ISqlMapper.cs Tue Oct 10 
11:57:36 2006
@@ -39,6 +39,7 @@
 using IBatisNet.DataMapper.DataExchange;
 using IBatisNet.DataMapper.Exceptions;
 using IBatisNet.DataMapper.MappedStatements;
+using IBatisNet.DataMapper.SessionStore;
 using IBatisNet.DataMapper.TypeHandlers;
 
 namespace IBatisNet.DataMapper
@@ -49,6 +50,20 @@
     public interface ISqlMapper
     {
 
+        /// <summary>
+        /// Name used to identify the the <see cref="SqlMapper"/>
+        /// </summary>
+        string Id { get; }
+        
+         /// <summary>
+        /// Allow to set a custom session store like the <see 
cref="HybridWebThreadSessionStore"/>
+        /// </summary>
+        /// <remarks>Set it after the configuration and before use of the <see 
cref="SqlMapper"/></remarks>
+        /// <example>
+        /// sqlMapper.SessionStore = new HybridWebThreadSessionStore( 
sqlMapper.Id );
+        /// </example>
+        ISessionStore SessionStore { set; }
+        
         /// <summary>
         /// Gets a value indicating whether this instance is session started.
         /// </summary>

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs 
Tue Oct 10 11:57:36 2006
@@ -550,13 +550,17 @@
                        {
                                IDataReader reader = command.ExecuteReader();
                 try 
-                {                      
-                                       while ( reader.Read() )
-                                       {
-                        object obj = _resultStrategy.Process(request, ref 
reader, null);
-                               
-                                               resultObject.Add( obj );
-                                       }
+                {
+                    do
+                    {
+                        while (reader.Read())
+                        {
+                            object obj = _resultStrategy.Process(request, ref 
reader, null);
+
+                            resultObject.Add(obj);
+                        }
+                    }
+                    while (reader.NextResult());
                            }
                 catch
                 {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
 Tue Oct 10 11:57:36 2006
@@ -30,7 +30,9 @@
 {
        /// <summary>
        /// Provides an implementation of <see cref="ISessionStore"/>
-       /// which relies on <c>CallContext</c>
+       /// which relies on <c>CallContext</c>.
+    /// This implementation will first get the current session from the 
current 
+    /// thread. Do NOT use on web scenario (web applications or web services).
        /// </summary>
        public class CallContextSessionStore : AbstractSessionStore
        {

Added: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs?view=auto&rev=462499
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs
 (added)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs
 Tue Oct 10 11:57:36 2006
@@ -0,0 +1,103 @@
+using System;
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 378715 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006 - Apache Fondation
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ 
********************************************************************************/
+#endregion
+
+using System.Runtime.Remoting.Messaging;
+using System.Web;
+using IBatisNet.Common;
+using IBatisNet.Common.Exceptions;
+
+namespace IBatisNet.DataMapper.SessionStore
+{
+    /// <summary>
+    /// This implementation of <see cref="ISessionStore"/>will first try 
+    /// to get the currentrequest, and if not found, will use a thread local.
+    /// </summary>
+    /// <remarks>
+    /// This is used for scenarios where most of the you need per request 
session, but you also does some work outside a 
+    /// request (in a thread pool thread, for instance).
+    /// </remarks>
+    public class HybridWebThreadSessionStore : AbstractSessionStore
+       {
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="WebSessionStore"/> 
class.
+        /// </summary>
+        /// <param name="sqlMapperId">The SQL mapper id.</param>
+        public HybridWebThreadSessionStore(string sqlMapperId): 
base(sqlMapperId)
+               {}
+
+               /// <summary>
+               /// Get the local session
+               /// </summary>
+        public override IDalSession LocalSession
+               {
+                       get
+                       {
+                HttpContext currentContext = HttpContext.Current;
+                if (currentContext == null)
+                {
+                    return CallContext.GetData(sessionName) as IDalSession; 
+                }
+                return currentContext.Items[sessionName] as IDalSession;
+                       }
+               }
+
+               /// <summary>
+               /// Store the specified session.
+               /// </summary>
+               /// <param name="session">The session to store</param>
+        public override void Store(IDalSession session)
+               {
+            HttpContext currentContext = HttpContext.Current;
+            if (currentContext == null)
+            {
+                CallContext.SetData(sessionName, session);
+            }
+                   else
+            {
+                currentContext.Items[sessionName] = session;
+            }
+               }
+
+               /// <summary>
+               /// Remove the local session.
+               /// </summary>
+               public override void Dispose()
+               {
+            HttpContext currentContext = HttpContext.Current;
+            if (currentContext == null)
+            {
+                CallContext.SetData(sessionName, null);
+            }
+                   else
+            {
+                           currentContext.Items[sessionName] = null;
+            }
+               }
+
+
+       }
+}

Propchange: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/HybridWebThreadSessionStore.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs 
Tue Oct 10 11:57:36 2006
@@ -33,6 +33,8 @@
        /// <summary>
        /// Provides an implementation of <see cref="ISessionStore"/>
        /// which relies on <c>HttpContext</c>. Suitable for web projects.
+    /// This implementation will get the current session from the current 
+    /// request.
        /// </summary>
        public class WebSessionStore : AbstractSessionStore
        {

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?view=diff&rev=462499&r1=462498&r2=462499
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Tue Oct 10 
11:57:36 2006
@@ -79,7 +79,7 @@
                /// <summary>
                /// Container session unique for each thread. 
                /// </summary>
-        private ISessionStore _sessionHolder = null;
+        private ISessionStore _sessionStore = null;
         private IObjectFactory _objectFactory = null;
         private AccessorFactory _accessorFactory = null;
         private DataExchangeFactory _dataExchangeFactory = null;
@@ -87,13 +87,33 @@
 
                #region Properties
 
+        /// <summary>
+        /// Name used to identify the the <see cref="SqlMapper"/>
+        /// </summary>
+        public string Id
+        {
+            get { return _id; }
+        }
+           
+        /// <summary>
+        /// Allow to set a custom session store like the <see 
cref="HybridWebThreadSessionStore"/>
+        /// </summary>
+        /// <remarks>Set it after the configuration and before use of the <see 
cref="SqlMapper"/></remarks>
+        /// <example>
+        /// sqlMapper.SessionStore = new HybridWebThreadSessionStore( 
sqlMapper.Id );
+        /// </example>
+        public ISessionStore SessionStore
+        {
+            set { _sessionStore = value; }
+        }
+           
                /// <summary>
                ///  Returns the DalSession instance 
                ///  currently being used by the SqlMap.
                /// </summary>
                public IDalSession LocalSession
                {
-                       get { return _sessionHolder.LocalSession; }
+                       get { return _sessionStore.LocalSession; }
                }
 
         /// <summary>
@@ -104,7 +124,7 @@
         /// </value>
                public bool IsSessionStarted
                {
-                       get { return (_sessionHolder.LocalSession != null); }
+                       get { return (_sessionStore.LocalSession != null); }
                }
 
                /// <summary>
@@ -168,7 +188,7 @@
 
             _dataExchangeFactory = new 
DataExchangeFactory(_typeHandlerFactory, _objectFactory, accessorFactory);
                        _id = 
HashCodeProvider.GetIdentityHashCode(this).ToString();
-            _sessionHolder = SessionStoreFactory.GetSessionStore(_id);
+            _sessionStore = SessionStoreFactory.GetSessionStore(_id);
                }
                #endregion
 
@@ -285,12 +305,12 @@
                /// <returns></returns>
                public IDalSession OpenConnection() 
                {
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke OpenConnection(). A connection is already started. Call CloseConnection 
first.");
                        }
             IDalSession session = CreateSqlMapSession();
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.OpenConnection();
                        return session;
                }
@@ -301,12 +321,12 @@
                /// <param name="connectionString">The connection string</param>
                public IDalSession OpenConnection(string connectionString)
                {
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke OpenConnection(). A connection is already started. Call CloseConnection 
first.");
                        }
             IDalSession session = CreateSqlMapSession();
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.OpenConnection(connectionString);
                        return session;
                }
@@ -316,13 +336,13 @@
                /// </summary>
                public void CloseConnection()
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke CloseConnection(). No connection was started. Call OpenConnection() 
first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.CloseConnection();                      
                        } 
                        catch(Exception ex)
@@ -331,7 +351,7 @@
                        }
                        finally 
                        {
-                               _sessionHolder.Dispose();
+                               _sessionStore.Dispose();
                        }
                }
 
@@ -341,12 +361,12 @@
                /// </summary>
                public IDalSession BeginTransaction() 
                {
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
             IDalSession session = CreateSqlMapSession();
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.BeginTransaction();
                        return session ;
                }
@@ -357,12 +377,12 @@
                /// <param name="connectionString">The connection string</param>
                public IDalSession BeginTransaction(string connectionString)
                {
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
             IDalSession session = CreateSqlMapSession();
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.BeginTransaction( connectionString );
                        return session ;
                }
@@ -381,7 +401,7 @@
                        }
                        else
                        {
-                               session = _sessionHolder.LocalSession;
+                               session = _sessionStore.LocalSession;
                                if (session == null) 
                                {
                                        throw new DataMapperException("SqlMap 
could not invoke BeginTransaction(). A session must be Open. Call 
OpenConnection() first.");
@@ -400,12 +420,12 @@
                /// </param>
                public IDalSession BeginTransaction(IsolationLevel 
isolationLevel)
                {
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
             IDalSession session = CreateSqlMapSession();
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.BeginTransaction(isolationLevel);
                        return session;
                }
@@ -417,12 +437,12 @@
                /// <param name="isolationLevel">The transaction isolation 
level for this connection.</param>
                public IDalSession BeginTransaction(string connectionString, 
IsolationLevel isolationLevel)
                {
-                       if (_sessionHolder.LocalSession != null) 
+                       if (_sessionStore.LocalSession != null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
             IDalSession session = CreateSqlMapSession();
-                       _sessionHolder.Store(session);
+                       _sessionStore.Store(session);
                        session.BeginTransaction( connectionString, 
isolationLevel);
                        return session;
                }
@@ -445,7 +465,7 @@
                        }
                        else
                        {
-                               session = _sessionHolder.LocalSession;
+                               session = _sessionStore.LocalSession;
                                if (session == null) 
                                {
                                        throw new DataMapperException("SqlMap 
could not invoke BeginTransaction(). A session must be Open. Call 
OpenConnection() first.");
@@ -472,7 +492,7 @@
                        }
                        else
                        {
-                               session = _sessionHolder.LocalSession;
+                               session = _sessionStore.LocalSession;
                                if (session == null) 
                                {
                                        throw new DataMapperException("SqlMap 
could not invoke BeginTransaction(). A session must be Open. Call 
OpenConnection() first.");
@@ -490,18 +510,18 @@
                /// </remarks>
                public void CommitTransaction()
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke CommitTransaction(). No Transaction was started. Call BeginTransaction() 
first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.CommitTransaction();
                        } 
                        finally 
                        {
-                               _sessionHolder.Dispose();
+                               _sessionStore.Dispose();
                        }
                }
 
@@ -511,20 +531,20 @@
                /// <param name="closeConnection">Close the connection</param>
                public void CommitTransaction(bool closeConnection)
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke CommitTransaction(). No Transaction was started. Call BeginTransaction() 
first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.CommitTransaction(closeConnection);
                        } 
                        finally 
                        {
                                if (closeConnection)
                                {
-                                       _sessionHolder.Dispose();
+                                       _sessionStore.Dispose();
                                }
                        }
                }
@@ -537,18 +557,18 @@
                /// </remarks>
                public void RollBackTransaction()
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke RollBackTransaction(). No Transaction was started. Call 
BeginTransaction() first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.RollBackTransaction();                  
                        } 
                        finally 
                        {
-                               _sessionHolder.Dispose();
+                               _sessionStore.Dispose();
                        }
                }
 
@@ -558,20 +578,20 @@
                /// <param name="closeConnection">Close the connection</param>
                public void RollBackTransaction(bool closeConnection)
                {
-                       if (_sessionHolder.LocalSession == null) 
+                       if (_sessionStore.LocalSession == null) 
                        {
                                throw new DataMapperException("SqlMap could not 
invoke RollBackTransaction(). No Transaction was started. Call 
BeginTransaction() first.");
                        }
                        try
                        {
-                               IDalSession session = 
_sessionHolder.LocalSession;
+                               IDalSession session = 
_sessionStore.LocalSession;
                                session.RollBackTransaction(closeConnection);   
                
                        } 
                        finally 
                        {
                                if (closeConnection)
                                {
-                                       _sessionHolder.Dispose();
+                                       _sessionStore.Dispose();
                                }
                        }
                }
@@ -593,7 +613,7 @@
                public object QueryForObject(string statementName, object 
parameterObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        object result;
  
                        if (session == null) 
@@ -634,7 +654,7 @@
                public object QueryForObject(string statementName, object 
parameterObject, object resultObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        object result = null;
  
                        if (session == null) 
@@ -681,7 +701,7 @@
         public T QueryForObject<T>(string statementName, object 
parameterObject)
         {
             bool isSessionLocal = false;
-            IDalSession session = _sessionHolder.LocalSession;
+            IDalSession session = _sessionStore.LocalSession;
             T result;
 
             if (session == null)
@@ -722,7 +742,7 @@
         public T QueryForObject<T>(string statementName, object 
parameterObject, T instanceObject)
         {
             bool isSessionLocal = false;
-            IDalSession session = _sessionHolder.LocalSession;
+            IDalSession session = _sessionStore.LocalSession;
             T result = default(T);
 
             if (session == null)
@@ -811,7 +831,7 @@
                public IDictionary QueryForMap(string statementName, object 
parameterObject, string keyProperty, string valueProperty)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        IDictionary map = null;
  
                        if (session == null) 
@@ -858,7 +878,7 @@
                public IList QueryForList(string statementName, object 
parameterObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        IList list;
  
                        if (session == null) 
@@ -902,7 +922,7 @@
                public IList QueryForList(string statementName, object 
parameterObject, int skipResults, int maxResults)        
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        IList list;
  
                        if (session == null) 
@@ -947,7 +967,7 @@
                public void QueryForList(string statementName, object 
parameterObject, IList resultObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
  
                        if (resultObject == null)
                        {
@@ -996,7 +1016,7 @@
         public IList<T> QueryForList<T>(string statementName, object 
parameterObject)
         {
             bool isSessionLocal = false;
-            IDalSession session = _sessionHolder.LocalSession;
+            IDalSession session = _sessionStore.LocalSession;
             IList<T> list;
 
             if (session == null)
@@ -1040,7 +1060,7 @@
         public IList<T> QueryForList<T>(string statementName, object 
parameterObject, int skipResults, int maxResults)
         {
             bool isSessionLocal = false;
-            IDalSession session = _sessionHolder.LocalSession;
+            IDalSession session = _sessionStore.LocalSession;
             IList<T> list;
 
             if (session == null)
@@ -1084,7 +1104,7 @@
         public void QueryForList<T>(string statementName, object 
parameterObject, IList<T> resultObject)
         {
             bool isSessionLocal = false;
-            IDalSession session = _sessionHolder.LocalSession;
+            IDalSession session = _sessionStore.LocalSession;
 
             if (resultObject == null)
             {
@@ -1150,7 +1170,7 @@
                public IList QueryWithRowDelegate(string statementName, object 
parameterObject, RowDelegate rowDelegate)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        IList list = null;
  
                        if (session == null) 
@@ -1195,7 +1215,7 @@
         public IList<T> QueryWithRowDelegate<T>(string statementName, object 
parameterObject, RowDelegate<T> rowDelegate)
         {
             bool isSessionLocal = false;
-            IDalSession session = _sessionHolder.LocalSession;
+            IDalSession session = _sessionStore.LocalSession;
             IList<T> list = null;
 
             if (session == null)
@@ -1243,7 +1263,7 @@
                public IDictionary QueryForMapWithRowDelegate(string 
statementName, object parameterObject, string keyProperty, string 
valueProperty, DictionaryRowDelegate rowDelegate)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        IDictionary map = null;
  
                        if (session == null) 
@@ -1296,7 +1316,7 @@
                public object Insert(string statementName, object 
parameterObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        object generatedKey = null;
  
                        if (session == null) 
@@ -1341,7 +1361,7 @@
                public int Update(string statementName, object parameterObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        int rows = 0; // the number of rows affected
 
                        if (session == null) 
@@ -1381,7 +1401,7 @@
                public int Delete(string statementName, object parameterObject)
                {
                        bool isSessionLocal = false;
-                       IDalSession session = _sessionHolder.LocalSession;
+                       IDalSession session = _sessionStore.LocalSession;
                        int rows = 0; // the number of rows affected
 
                        if (session == null) 


Reply via email to