Author: rgrabowski
Date: Thu Aug 10 14:24:45 2006
New Revision: 430536

URL: http://svn.apache.org/viewvc?rev=430536&view=rev
Log:
Replaced SqlMapSession with IDalSession. Allow classes that extend SqlMapper to 
supply their own IDalSession via CreateSession method.

Modified:
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/AbstractSessionStore.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/ISessionStore.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/AbstractSessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/AbstractSessionStore.cs?rev=430536&r1=430535&r2=430536&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/AbstractSessionStore.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/AbstractSessionStore.cs
 Thu Aug 10 14:24:45 2006
@@ -24,6 +24,7 @@
 #endregion
 
 using System;
+using IBatisNet.Common;
 
 namespace IBatisNet.DataMapper.SessionStore
 {
@@ -51,7 +52,7 @@
                /// <summary>
                /// Get the local session
                /// </summary>
-        public abstract SqlMapSession LocalSession
+        public abstract IDalSession LocalSession
                {
                        get; 
                }
@@ -61,7 +62,7 @@
         /// Store the specified session.
         /// </summary>
         /// <param name="session">The session to store</param>
-        public abstract void Store(SqlMapSession session);
+        public abstract void Store(IDalSession session);
 
                /// <summary>
                /// Remove the local session from the storage.

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?rev=430536&r1=430535&r2=430536&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/CallContextSessionStore.cs
 Thu Aug 10 14:24:45 2006
@@ -24,6 +24,7 @@
 #endregion
 
 using System.Runtime.Remoting.Messaging;
+using IBatisNet.Common;
 
 namespace IBatisNet.DataMapper.SessionStore
 {
@@ -44,16 +45,16 @@
                /// <summary>
                /// Get the local session
                /// </summary>
-        public override SqlMapSession LocalSession
+        public override IDalSession LocalSession
                {
-            get { return CallContext.GetData(sessionName) as SqlMapSession; }
+            get { return CallContext.GetData(sessionName) as IDalSession; }
                }
 
                /// <summary>
                /// Store the specified session.
                /// </summary>
                /// <param name="session">The session to store</param>
-        public override void Store(SqlMapSession session)
+        public override void Store(IDalSession session)
                {
                        CallContext.SetData(sessionName, session);
                }

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/ISessionStore.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/ISessionStore.cs?rev=430536&r1=430535&r2=430536&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/ISessionStore.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/ISessionStore.cs 
Thu Aug 10 14:24:45 2006
@@ -23,6 +23,7 @@
  
********************************************************************************/
 #endregion
 
+using IBatisNet.Common;
 
 namespace IBatisNet.DataMapper.SessionStore
 {
@@ -35,7 +36,7 @@
                /// <summary>
                /// Get the local session
                /// </summary>
-        SqlMapSession LocalSession
+        IDalSession LocalSession
                {
                        get; 
                }
@@ -44,7 +45,7 @@
                /// Store the specified session.
                /// </summary>
                /// <param name="session">The session to store</param>
-        void Store(SqlMapSession session);
+        void Store(IDalSession session);
 
                /// <summary>
                /// Remove the local session from the storage.

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?rev=430536&r1=430535&r2=430536&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SessionStore/WebSessionStore.cs 
Thu Aug 10 14:24:45 2006
@@ -24,6 +24,7 @@
 #endregion
 
 using System.Web;
+using IBatisNet.Common;
 using IBatisNet.Common.Exceptions;
 
 namespace IBatisNet.DataMapper.SessionStore
@@ -46,12 +47,12 @@
                /// <summary>
                /// Get the local session
                /// </summary>
-        public override SqlMapSession LocalSession
+        public override IDalSession LocalSession
                {
                        get
                        {
                                HttpContext currentContext = 
ObtainSessionContext();
-                return currentContext.Items[sessionName] as SqlMapSession;
+                return currentContext.Items[sessionName] as IDalSession;
                        }
                }
 
@@ -59,7 +60,7 @@
                /// Store the specified session.
                /// </summary>
                /// <param name="session">The session to store</param>
-        public override void Store(SqlMapSession session)
+        public override void Store(IDalSession session)
                {
                        HttpContext currentContext = ObtainSessionContext();
                        currentContext.Items[sessionName] = session;

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?rev=430536&r1=430535&r2=430536&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Thu Aug 10 
14:24:45 2006
@@ -323,7 +323,7 @@
                        {
                                throw new DataMapperException("SqlMap could not 
invoke OpenConnection(). A connection is already started. Call CloseConnection 
first.");
                        }
-                       SqlMapSession session = new SqlMapSession(this);
+                       IDalSession session = CreateSession();
                        _sessionHolder.Store(session);
                        session.OpenConnection();
                        return session;
@@ -339,7 +339,7 @@
                        {
                                throw new DataMapperException("SqlMap could not 
invoke OpenConnection(). A connection is already started. Call CloseConnection 
first.");
                        }
-                       SqlMapSession session = new SqlMapSession(this);
+                       IDalSession session = CreateSession();
                        _sessionHolder.Store(session);
                        session.OpenConnection(connectionString);
                        return session;
@@ -379,7 +379,7 @@
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
-                       SqlMapSession session = new SqlMapSession(this);
+                       IDalSession session = CreateSession();
                        _sessionHolder.Store(session);
                        session.BeginTransaction();
                        return session ;
@@ -395,7 +395,7 @@
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
-                       SqlMapSession session = new SqlMapSession(this);
+                       IDalSession session = CreateSession();
                        _sessionHolder.Store(session);
                        session.BeginTransaction( connectionString );
                        return session ;
@@ -438,7 +438,7 @@
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
-                       SqlMapSession session = new SqlMapSession(this);
+                       IDalSession session = CreateSession();
                        _sessionHolder.Store(session);
                        session.BeginTransaction(isolationLevel);
                        return session;
@@ -455,7 +455,7 @@
                        {
                                throw new DataMapperException("SqlMap could not 
invoke BeginTransaction(). A Transaction is already started. Call 
CommitTransaction() or RollbackTransaction first.");
                        }
-                       SqlMapSession session = new SqlMapSession(this);
+                       IDalSession session = CreateSession();
                        _sessionHolder.Store(session);
                        session.BeginTransaction( connectionString, 
isolationLevel);
                        return session;
@@ -632,7 +632,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -673,7 +673,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -720,7 +720,7 @@
 
             if (session == null)
             {
-                session = new SqlMapSession(this);
+                session = CreateSqlMapSession();
                 session.OpenConnection();
                 isSessionLocal = true;
             }
@@ -761,7 +761,7 @@
 
             if (session == null)
             {
-                session = new SqlMapSession(this);
+                session = CreateSqlMapSession();
                 session.OpenConnection();
                 isSessionLocal = true;
             }
@@ -850,7 +850,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -897,7 +897,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -941,7 +941,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -990,7 +990,7 @@
 
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -1035,7 +1035,7 @@
 
             if (session == null)
             {
-                session = new SqlMapSession(this);
+                session = CreateSqlMapSession();
                 session.OpenConnection();
                 isSessionLocal = true;
             }
@@ -1079,7 +1079,7 @@
 
             if (session == null)
             {
-                session = new SqlMapSession(this);
+                session = CreateSqlMapSession();
                 session.OpenConnection();
                 isSessionLocal = true;
             }
@@ -1127,7 +1127,7 @@
 
             if (session == null)
             {
-                session = new SqlMapSession(this);
+                session = CreateSqlMapSession();
                 session.OpenConnection();
                 isSessionLocal = true;
             }
@@ -1189,7 +1189,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -1234,7 +1234,7 @@
 
             if (session == null)
             {
-                session = new SqlMapSession(this);
+                session = CreateSqlMapSession();
                 session.OpenConnection();
                 isSessionLocal = true;
             }
@@ -1282,7 +1282,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -1335,7 +1335,7 @@
  
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -1380,7 +1380,7 @@
 
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -1420,7 +1420,7 @@
 
                        if (session == null) 
                        {
-                               session = new SqlMapSession(this);
+                               session = CreateSession();
                                session.OpenConnection();
                                isSessionLocal = true;
                        }
@@ -1651,6 +1651,15 @@
                }
 
                #endregion
+
+               /// <summary>
+               /// Creates a new IDalSession that will be used to query the 
data source.
+               /// </summary>
+               /// <returns></returns>
+               protected IDalSession CreateSession()
+               {
+                       return new SqlMapSession(this);
+               }
 
                #endregion
        }


Reply via email to