Author: rgrabowski
Date: Sun Jun 28 02:12:00 2009
New Revision: 789034

URL: http://svn.apache.org/viewvc?rev=789034&view=rev
Log:
Update SqlClient.Text project from .NET 3.0 to .NET 3.5.
Expose ConfigurationSetting object in BaseTest to allow StatementNamespaceTest 
to run only when UseStatementNamespaces=true.
Refactored ThreadTest.
Added PostStatementEventArgs.CacheHit property that is set when the 
ResultObject comes from cache.
Added TestJIRA242WithCacheAndPostStatementEventArgs test case for new 
PostStatementEventArgs.CacheHit property.






Modified:
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Apache.Ibatis.DataMapper.SqlClient.Test.csproj
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/BaseTest.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/CacheTest.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/StatementNamespaceTest.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/ThreadTest.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteInsert.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForDataTable.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForList.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForMap.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForObject.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteUpdate.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatementEventSupport.cs
    
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Events/PostStatementEventArgs.cs

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Apache.Ibatis.DataMapper.SqlClient.Test.csproj
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Apache.Ibatis.DataMapper.SqlClient.Test.csproj?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Apache.Ibatis.DataMapper.SqlClient.Test.csproj
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Apache.Ibatis.DataMapper.SqlClient.Test.csproj
 Sun Jun 28 02:12:00 2009
@@ -14,7 +14,7 @@
     <OldToolsVersion>2.0</OldToolsVersion>
     <UpgradeBackupLocation>
     </UpgradeBackupLocation>
-    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' 
">
     <DebugSymbols>true</DebugSymbols>
@@ -45,6 +45,9 @@
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.configuration" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Xml" />

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/BaseTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/BaseTest.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/BaseTest.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/BaseTest.cs
 Sun Jun 28 02:12:00 2009
@@ -35,6 +35,7 @@
         protected static KeyConvert ConvertKey = null;
         protected static ISessionFactory sessionFactory = null;
         protected ISessionStore sessionStore = null;
+        protected ConfigurationSetting configurationSetting;
 
         /// <summary>
         /// Initialize an sqlMap
@@ -44,7 +45,7 @@
         {
             //DateTime start = DateTime.Now;
 
-            ConfigurationSetting configurationSetting = new 
ConfigurationSetting();
+            configurationSetting = new ConfigurationSetting();
             configurationSetting.Properties.Add("collection2Namespace", 
"Apache.Ibatis.DataMapper.SqlClient.Test.Domain.LineItemCollection2, 
Apache.Ibatis.DataMapper.SqlClient.Test");
             configurationSetting.Properties.Add("nullableInt", "int?");
 

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/CacheTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/CacheTest.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/CacheTest.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/CacheTest.cs
 Sun Jun 28 02:12:00 2009
@@ -1,6 +1,7 @@
 
 using System;
 using System.Collections;
+using System.Collections.Generic;
 using System.Threading;
 using Apache.Ibatis.Common.Utilities;
 
@@ -86,6 +87,31 @@
         }
 
         /// <summary>
+        /// Cache error with QueryForObject<T> PostStatementEventArgs with 
object in cache
+        /// </summary>
+        [Test]
+        public void TestJIRA242WithCacheAndPostStatementEventArgs()
+        {
+            List<bool> postSelectedWithCacheHitCalled = new List<bool>();
+
+            IMappedStatement statement = 
((IModelStoreAccessor)dataMapper).ModelStore.GetMappedStatement("GetNoAccountWithCache");
+            statement.PostSelect += (sender, e) => 
postSelectedWithCacheHitCalled.Add(e.CacheHit);
+
+            Account first = 
dataMapper.QueryForObject<Account>("GetNoAccountWithCache", 1);
+            Account second = 
dataMapper.QueryForObject<Account>("GetNoAccountWithCache", 1);
+            Assert.AreEqual(first.Id, second.Id);
+
+            // ensure the PostSelect event was called twice
+            Assert.IsTrue(postSelectedWithCacheHitCalled.Count == 2);
+
+            // the first time through we should get CacheHit==false because 
the cache is empty
+            Assert.IsFalse(postSelectedWithCacheHitCalled[0]);
+
+            // the second time through we should get CacheHit==true
+            Assert.IsTrue(postSelectedWithCacheHitCalled[1]);
+        }
+
+        /// <summary>
         /// Cache error with QueryForObjectwith object in cache
         /// </summary>
         [Test]

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/StatementNamespaceTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/StatementNamespaceTest.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/StatementNamespaceTest.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/StatementNamespaceTest.cs
 Sun Jun 28 02:12:00 2009
@@ -44,8 +44,16 @@
         /// </summary>
         [Test] 
         public void TestQueryForObject() {
-            Account account = 
dataMapper.QueryForObject("Account.GetAccountViaResultClass", 1) as Account;
-            AssertAccount1(account);
+
+            if (configurationSetting.UseStatementNamespaces)
+            {
+                Account account = 
dataMapper.QueryForObject("Account.GetAccountViaResultClass", 1) as Account;
+                AssertAccount1(account);
+            }
+            else
+            {
+                Assert.Ignore("UseStatementNamespaces is false, skipping");
+            }
         }
 
         /// <summary>
@@ -55,14 +63,22 @@
         /// </summary>
         [Test]
         public void TestListMapping() {
-            Order order = (Order) 
dataMapper.QueryForObject("Order.GetOrderWithLineItemsUsingStatementNamespaces",
 1);
-
-            AssertOrder1(order);
-
-            // Check IList collection
-            Assert.IsNotNull(order.LineItemsIList);
-            Assert.AreEqual(3, order.LineItemsIList.Count);
 
+            if (configurationSetting.UseStatementNamespaces)
+            {
+                Order order =
+                    (Order) 
dataMapper.QueryForObject("Order.GetOrderWithLineItemsUsingStatementNamespaces",
 1);
+
+                AssertOrder1(order);
+
+                // Check IList collection
+                Assert.IsNotNull(order.LineItemsIList);
+                Assert.AreEqual(3, order.LineItemsIList.Count);
+            }
+            else
+            {
+                Assert.Ignore("UseStatementNamespaces is false, skipping");
+            }
         }
 
         /// <summary>
@@ -73,12 +89,20 @@
         /// </summary>
         [Test] 
         public void TestInsertSelectKey() {
-            Category category = new Category();
-            category.Name = "toto";
-            category.Guid = Guid.NewGuid();
 
-            int key = 
(int)dataMapper.Insert("Category.InsertCategoryViaInsertStatement", category);
-            Assert.AreEqual(1, key);
+            if (configurationSetting.UseStatementNamespaces)
+            {
+                Category category = new Category();
+                category.Name = "toto";
+                category.Guid = Guid.NewGuid();
+
+                int key = (int) 
dataMapper.Insert("Category.InsertCategoryViaInsertStatement", category);
+                Assert.AreEqual(1, key);
+            }
+            else
+            {
+                Assert.Ignore("UseStatementNamespaces is false, skipping");
+            }
         }
 
         #endregion

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/ThreadTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/ThreadTest.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/ThreadTest.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper.SqlClient.Test/Fixtures/Mapping/ThreadTest.cs
 Sun Jun 28 02:12:00 2009
@@ -1,10 +1,6 @@
 using System;
-using System.Reflection;
 using System.Threading;
-using Apache.Ibatis.Common.Logging;
-using Apache.Ibatis.DataMapper.Session;
 using Apache.Ibatis.DataMapper.SqlClient.Test.Domain;
-using Apache.Ibatis.DataMapper.SqlClient.Test.Fixtures;
 using NUnit.Framework;
 
 namespace Apache.Ibatis.DataMapper.SqlClient.Test.Fixtures.Mapping
@@ -15,7 +11,6 @@
     [TestFixture] 
     public class ThreadTest: BaseTest
     {
-        private static readonly int numberOfThreads = 10;
         private readonly ManualResetEvent startEvent = new 
ManualResetEvent(false);
         private readonly ManualResetEvent stopEvent = new 
ManualResetEvent(false);
 
@@ -39,116 +34,78 @@
 
         #endregion
 
-        #region Thread test
-
         [Test]
         public void TestCommonUsageMultiThread()
         {
-            const int threadCount = 10;
+            // 10 threads for 5 seconds
+            RunThreadsForDuration(10, 5, i =>
+             {
+                 string prefix = String.Format("[Thread #{0:00} HashCode: 
{1:00}]: ", i, Thread.CurrentThread.GetHashCode());
+
+                 // ???
+                 Assert.IsNull(sessionStore.CurrentSession);
+
+                 Console.WriteLine(prefix + "Beginning");
+                 int parameter = i % 2 == 0 ? 2 : 1; // check parity of 
current thread
+                 Account account = 
(Account)dataMapper.QueryForObject("GetAccountViaColumnIndex", parameter);
+                 Assert.IsNull(sessionStore.CurrentSession);
+                 Console.WriteLine(prefix + "AssertAccount" + parameter);
+                 if (parameter == 1)
+                 {
+                     AssertAccount1(account);
+                 }
+                 else
+                 {
+                     AssertAccount2(account);
+                 }
+                 Console.WriteLine(prefix + "Ending");
+             });
+        }
 
-            Thread[] threads = new Thread[threadCount];
-                       
-            for(int i = 0; i < threadCount; i++)
+        public void RunThreadsForDuration(int numberOfThreads, int duration, 
Action<int> action)
+        {
+            Thread[] threads = new Thread[numberOfThreads];
+            for (int i = 0; i < numberOfThreads; i++)
             {
-                bool isEventAccountId = i % 2 == 0 ? true : false;
-
-                threads[i] = new Thread(ExecuteMethodUntilSignal);
-                threads[i].Start(isEventAccountId);
+                threads[i] = new Thread(ExecuteUntilSignal);
+                threads[i].Start(new CurrentThreadActionInfo(i, action));
             }
-
             startEvent.Set();
-
-            Thread.CurrentThread.Join(1 * 2000);
-
+            Thread.CurrentThread.Join(1000 * duration);
             stopEvent.Set();
+
+            // give things time to stop ???
+            Thread.Sleep(2000);
         }
 
-        public void ExecuteMethodUntilSignal(object state)
+        public void ExecuteUntilSignal(object state)
         {
-            bool isEventAccountId = (bool)state;
+            var actionInfo = (CurrentThreadActionInfo)state;
 
-            startEvent.WaitOne(int.MaxValue, false);
+            Console.WriteLine("Queueing thread #{0} until all threads are 
ready to start...", actionInfo.CurrentThread);
 
+            startEvent.WaitOne(int.MaxValue, false);
             while (!stopEvent.WaitOne(1, false))
             {
-                Assert.IsNull(sessionStore.CurrentSession);
-
-                Console.WriteLine("Begin Thread : " + 
Thread.CurrentThread.GetHashCode());
-
-                int parameter = isEventAccountId ? 2 : 1;
-
-                Account account = 
(Account)dataMapper.QueryForObject("GetAccountViaColumnIndex", parameter);
-
-                Assert.IsNull(sessionStore.CurrentSession);
-
-                if (parameter == 1)
-                {
-                    AssertAccount1(account);
-                }
-                else
-                {
-                    AssertAccount2(account);
-                }
-
-                Console.WriteLine("End Thread : " + 
Thread.CurrentThread.GetHashCode());
+                actionInfo.Invoke();
             }
         }
 
-        /// <summary>
-        /// Test BeginTransaction, CommitTransaction
-        /// </summary>
-        [Test] 
-        public void TestThread() 
+        class CurrentThreadActionInfo
         {
-            Account account = NewAccount6();
-
-            try 
-            {
-                Thread[] threads = new Thread[numberOfThreads];
-
-                AccessTest accessTest = new AccessTest();
+            public int CurrentThread { get; private set; }
+            public Action<int> Action { get; private set; }
 
-                for (int i = 0; i < numberOfThreads; i++) 
-                {
-                    Thread thread = new Thread(new 
ThreadStart(accessTest.GetAccount));
-                    threads[i] = thread;
-                }
-                for (int i = 0; i < numberOfThreads; i++) 
-                {
-                    threads[i].Start();
-                }
-            } 
-            finally 
+            public CurrentThreadActionInfo(int currentThread, Action<int> 
action)
             {
+                CurrentThread = currentThread;
+                Action = action;
             }
 
-        }
-
-        #endregion
-
-        /// <summary>
-        /// Summary description for AccessTest.
-        /// </summary>
-        private class AccessTest
-        {
-               
-            /// <summary>
-            /// Get an account
-            /// </summary>
-            public void GetAccount()
+            public void Invoke()
             {
-                ISessionStore sessionStore = 
((IModelStoreAccessor)dataMapper).ModelStore.SessionStore;
-
-                Assert.IsNull(sessionStore.CurrentSession);
-
-                Account account = 
(Account)dataMapper.QueryForObject("GetAccountViaColumnIndex", 1);
-
-                Assert.IsNull(sessionStore.CurrentSession);
-
-                Assert.AreEqual(1, account.Id, "account.Id");
-                Assert.AreEqual("Joe", account.FirstName, "account.FirstName");
-                Assert.AreEqual("Dalton", account.LastName, 
"account.LastName");
+                Action(CurrentThread);
             }
-        }      
+        }
     }
 }
\ No newline at end of file

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
 Sun Jun 28 02:12:00 2009
@@ -257,7 +257,7 @@
         {
             IList list = null;
 
-            object param = RaisePreEvent(PreSelectEvent, parameterObject);
+            object param = RaisePreEvent(PreSelectEventKey, parameterObject);
 
             RequestScope request = Statement.Sql.GetRequestScope(this, param, 
session);
 
@@ -266,14 +266,16 @@
             CacheKey cacheKey = GetCacheKey(request);
             cacheKey.Update("ExecuteQueryForList");
 
+            bool cacheHit = true;
             list = Statement.CacheModel[cacheKey] as IList;
             if (list == null)
             {
+                cacheHit = false;
                 list = mappedStatement.RunQueryForList(request, session, 
param, null, null);
                 Statement.CacheModel[cacheKey] = list;
             }
 
-            return RaisePostEvent(PostSelectEvent, param, list);
+            return RaisePostEvent(PostSelectEventKey, param, list, cacheHit);
         }
         #endregion
 
@@ -300,7 +302,7 @@
         {
             IList<T> list = null;
 
-            object param = RaisePreEvent(PreSelectEvent, parameterObject);
+            object param = RaisePreEvent(PreSelectEventKey, parameterObject);
 
             RequestScope request = Statement.Sql.GetRequestScope(this, param, 
session);
 
@@ -309,13 +311,15 @@
             CacheKey cacheKey = GetCacheKey(request);
             cacheKey.Update("ExecuteQueryForList");
 
+            bool cacheHit = true;
             list = Statement.CacheModel[cacheKey] as IList<T>;
             if (list == null)
             {
+                cacheHit = false;
                 list = mappedStatement.RunQueryForList<T>(request, session, 
param, null, null);
                 Statement.CacheModel[cacheKey] = list;
             }
-            return RaisePostEvent(PostSelectEvent, param, list);
+            return RaisePostEvent(PostSelectEventKey, param, list, cacheHit);
         }
         #endregion
 
@@ -333,7 +337,7 @@
                {
                        object obj = null;
 
-            object param = RaisePreEvent(PreSelectEvent, parameterObject);
+            object param = RaisePreEvent(PreSelectEventKey, parameterObject);
 
             RequestScope request = Statement.Sql.GetRequestScope(this, param, 
session);
 
@@ -342,6 +346,7 @@
                        CacheKey cacheKey = GetCacheKey(request);
                        cacheKey.Update("ExecuteQueryForObject");
 
+            bool cacheHit = true;
             obj = Statement.CacheModel[cacheKey];
                        // check if this query has alreay been run 
             if (obj == CacheModel.NULL_OBJECT) 
@@ -351,11 +356,12 @@
                        } 
                        else if (obj ==null)
                        {
+                cacheHit = false;
                 obj = mappedStatement.RunQueryForObject(request, session, 
param, resultObject);
                 Statement.CacheModel[cacheKey] = obj;
                        }
 
-            return RaisePostEvent(PostSelectEvent, param, obj);
+            return RaisePostEvent(PostSelectEventKey, param, obj, cacheHit);
         }
         
         #endregion
@@ -372,9 +378,9 @@
         /// <returns>The object</returns>
         public T ExecuteQueryForObject<T>(ISession session, object 
parameterObject, T resultObject)
         {
-            T obj = default(T);
+            T obj; // = default(T);
 
-            object param = RaisePreEvent(PreSelectEvent, parameterObject);
+            object param = RaisePreEvent(PreSelectEventKey, parameterObject);
 
             RequestScope request = Statement.Sql.GetRequestScope(this, param, 
session);
 
@@ -383,15 +389,18 @@
             CacheKey cacheKey = GetCacheKey(request);
             cacheKey.Update("ExecuteQueryForObject");
 
+            bool cacheHit = false;
             object cacheObjet = Statement.CacheModel[cacheKey];
             // check if this query has alreay been run 
             if (cacheObjet is T)
             {
+                cacheHit = true;
                 obj = (T)cacheObjet;
             }
             else if (cacheObjet == CacheModel.NULL_OBJECT)
             {
                 // convert the marker object back into a null value 
+                cacheHit = true;
                 obj = default(T);
             }
             else //if ((object)obj == null)
@@ -400,7 +409,7 @@
                 Statement.CacheModel[cacheKey] = obj;
             }
 
-            return RaisePostEvent(PostSelectEvent, param, obj);
+            return RaisePostEvent(PostSelectEventKey, param, obj, cacheHit);
         }
         
         #endregion

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteInsert.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteInsert.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteInsert.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteInsert.cs
 Sun Jun 28 02:12:00 2009
@@ -42,7 +42,7 @@
         /// <returns>Can return the insert generated key.</returns>
         public virtual object ExecuteInsert(ISession session, object 
parameterObject)
         {
-            return 
Execute(PreInsertEvent,PostInsertEvent,session,parameterObject,
+            return 
Execute(PreInsertEventKey,PostInsertEventKey,session,parameterObject,
                (r, p) =>
                {
                    #region RunInsert

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForDataTable.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForDataTable.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForDataTable.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForDataTable.cs
 Sun Jun 28 02:12:00 2009
@@ -40,10 +40,10 @@
         /// <returns>The object</returns>
         public virtual DataTable ExecuteQueryForDataTable(ISession session, 
object parameterObject)
         {
-            return Execute(PreSelectEvent, PostSelectEvent, session, 
parameterObject,
+            return Execute(PreSelectEventKey, PostSelectEventKey, session, 
parameterObject,
                 (r, p) => RunQueryForForDataTable(r, session, 
parameterObject));
 
-            // return RaisePostEvent<DataTable, 
PostSelectEventArgs>(PostSelectEvent, param, dataTable);
+            // return RaisePostEvent<DataTable, 
PostSelectEventArgs>(PostSelectEventKey, param, dataTable);
         }
 
         /// <summary>

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForList.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForList.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForList.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForList.cs
 Sun Jun 28 02:12:00 2009
@@ -44,7 +44,7 @@
         /// <param name="rowDelegate"></param>
         public virtual IList ExecuteQueryForRowDelegate(ISession session, 
object parameterObject, RowDelegate rowDelegate)
         {
-            return Execute(PreSelectEvent, PostSelectEvent, session, 
parameterObject,
+            return Execute(PreSelectEventKey, PostSelectEventKey, session, 
parameterObject,
                  (r, p) => RunQueryForList(r, session, p, null, rowDelegate));
         }
 
@@ -62,7 +62,7 @@
                 throw new DataMapperException("A null RowDelegate was passed 
to QueryForRowDelegate.");
             }
 
-            return Execute(PreSelectEvent, PostSelectEvent, session, 
parameterObject,
+            return Execute(PreSelectEventKey, PostSelectEventKey, session, 
parameterObject,
                 (r, p) => RunQueryForList(r, session, p, null, rowDelegate));
         }
 
@@ -74,7 +74,7 @@
         /// <returns>A List of result objects.</returns>
         public virtual IList ExecuteQueryForList(ISession session, object 
parameterObject)
         {
-            return 
Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            return 
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                 (r, p) => RunQueryForList(r, session, p, null, null));
         }
 
@@ -86,7 +86,7 @@
         /// <param name="resultObject">A strongly typed collection of result 
objects.</param>
         public virtual void ExecuteQueryForList(ISession session, object 
parameterObject, IList resultObject)
         {
-            Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                 (r, p) => RunQueryForList(r, session, p, resultObject, null));
         }
 
@@ -98,7 +98,7 @@
         /// <returns>A List of result objects.</returns>
         public virtual IList<T> ExecuteQueryForList<T>(ISession session, 
object parameterObject)
         {
-            return Execute(PreSelectEvent, PostSelectEvent, session, 
parameterObject,
+            return Execute(PreSelectEventKey, PostSelectEventKey, session, 
parameterObject,
                 (r, p) => RunQueryForList<T>(r, session, p, null, null));
         }
 
@@ -110,7 +110,7 @@
         /// <param name="resultObject">A strongly typed collection of result 
objects.</param>
         public virtual void ExecuteQueryForList<T>(ISession session, object 
parameterObject, IList<T> resultObject)
         {
-            Execute(PreSelectEvent, PostSelectEvent, session, parameterObject,
+            Execute(PreSelectEventKey, PostSelectEventKey, session, 
parameterObject,
                 (r, p) => RunQueryForList(r, session, p, resultObject, null));
         }
 

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForMap.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForMap.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForMap.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForMap.cs
 Sun Jun 28 02:12:00 2009
@@ -48,7 +48,7 @@
         ///<exception cref="DataMapperException">If a transaction is not in 
progress, or the database throws an exception.</exception>
         public virtual IDictionary ExecuteQueryForMap(ISession session, object 
parameterObject, string keyProperty, string valueProperty)
         {
-            return 
Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            return 
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                 (r, p) => RunQueryForMap(r, session, p, keyProperty, 
valueProperty, null));
         }
 
@@ -65,7 +65,7 @@
         ///<exception 
cref="Apache.Ibatis.DataMapper.Exceptions.DataMapperException">If a transaction 
is not in progress, or the database throws an exception.</exception>
         public virtual IDictionary<K, V> ExecuteQueryForDictionary<K, 
V>(ISession session, object parameterObject, string keyProperty, string 
valueProperty)
         {
-            return 
Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            return 
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                 (r, p) => RunQueryForDictionary<K, V>(r, session, p, 
keyProperty, valueProperty, null));
         }
 
@@ -87,7 +87,7 @@
                 throw new DataMapperException("A null DictionaryRowDelegate 
was passed to QueryForDictionary.");
             }
 
-            return 
Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            return 
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                 (r, p) => RunQueryForDictionary(r, session, p, keyProperty, 
valueProperty, rowDelegate));
         }
 
@@ -109,7 +109,7 @@
                 throw new DataMapperException("A null DictionaryRowDelegate 
was passed to QueryForMapWithRowDelegate.");
             }
 
-            return 
Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            return 
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                (r, p) => RunQueryForMap(r, session, p, keyProperty, 
valueProperty, rowDelegate));
         }
 

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForObject.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForObject.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForObject.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteQueryForObject.cs
 Sun Jun 28 02:12:00 2009
@@ -54,7 +54,7 @@
         /// <returns>The object</returns>
         public virtual T ExecuteQueryForObject<T>(ISession session, object 
parameterObject, T resultObject)
         {
-            return 
Execute(PreSelectEvent,PostSelectEvent,session,parameterObject,
+            return 
Execute(PreSelectEventKey,PostSelectEventKey,session,parameterObject,
                 (r, p) => RunQueryForObject(r, session, p, resultObject));
         }
 

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteUpdate.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteUpdate.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteUpdate.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.ExecuteUpdate.cs
 Sun Jun 28 02:12:00 2009
@@ -39,7 +39,7 @@
         /// <returns>The number of row effected.</returns>
         public virtual int ExecuteUpdate(ISession session, object 
parameterObject)
         {
-            return 
Execute(PreUpdateOrDeleteEvent,PostUpdateOrDeleteEvent,session,parameterObject,
+            return 
Execute(PreUpdateOrDeleteEventKey,PostUpdateOrDeleteEventKey,session,parameterObject,
                (r, p) =>
                {
                    int rows; // the number of rows affected

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
 Sun Jun 28 02:12:00 2009
@@ -216,7 +216,7 @@
             Executed(this, e);
         }
 
-        public virtual T Execute<T>(object preEvent, object postEvent, 
ISession session, object parameterObject, Func<RequestScope, object, T> 
requestRunner)
+        protected virtual T Execute<T>(object preEvent, object postEvent, 
ISession session, object parameterObject, Func<RequestScope, object, T> 
requestRunner)
         {
             object paramPreEvent = RaisePreEvent(preEvent, parameterObject);
 
@@ -226,7 +226,7 @@
 
             RaiseExecuteEvent();
 
-            return RaisePostEvent(postEvent, paramPreEvent, result);
+            return RaisePostEvent(postEvent, paramPreEvent, result, false);
         }
     }
 }

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatementEventSupport.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatementEventSupport.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatementEventSupport.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/MappedStatements/MappedStatementEventSupport.cs
 Sun Jun 28 02:12:00 2009
@@ -35,12 +35,12 @@
     [Serializable]
     public abstract class MappedStatementEventSupport : IMappedStatementEvents
     {
-        protected static readonly object PreInsertEvent = new object();
-        protected static readonly object PreSelectEvent = new object();
-        protected static readonly object PreUpdateOrDeleteEvent = new object();
-        protected static readonly object PostInsertEvent = new object();
-        protected static readonly object PostSelectEvent = new object();
-        protected static readonly object PostUpdateOrDeleteEvent = new 
object();
+        protected static readonly object PreInsertEventKey = new object();
+        protected static readonly object PreSelectEventKey = new object();
+        protected static readonly object PreUpdateOrDeleteEventKey = new 
object();
+        protected static readonly object PostInsertEventKey = new object();
+        protected static readonly object PostSelectEventKey = new object();
+        protected static readonly object PostUpdateOrDeleteEventKey = new 
object();
 
         private readonly EventHandlerList events = new EventHandlerList();
 
@@ -51,8 +51,8 @@
         /// </summary>
         public event EventHandler<PreStatementEventArgs> PreInsert
         {
-            add { events.AddHandler(PreInsertEvent, value); }
-            remove { events.RemoveHandler(PreInsertEvent, value); }
+            add { events.AddHandler(PreInsertEventKey, value); }
+            remove { events.RemoveHandler(PreInsertEventKey, value); }
         }
 
         /// <summary>
@@ -60,8 +60,8 @@
         /// </summary>
         public event EventHandler<PreStatementEventArgs> PreSelect
         {
-            add { events.AddHandler(PreSelectEvent, value); }
-            remove { events.RemoveHandler(PreSelectEvent, value); }
+            add { events.AddHandler(PreSelectEventKey, value); }
+            remove { events.RemoveHandler(PreSelectEventKey, value); }
         }
 
         /// <summary>
@@ -69,8 +69,8 @@
         /// </summary>
         public event EventHandler<PreStatementEventArgs> PreUpdateOrDelete
         {
-            add { events.AddHandler(PreUpdateOrDeleteEvent, value); }
-            remove { events.RemoveHandler(PreUpdateOrDeleteEvent, value); }
+            add { events.AddHandler(PreUpdateOrDeleteEventKey, value); }
+            remove { events.RemoveHandler(PreUpdateOrDeleteEventKey, value); }
         }
 
         /// <summary>
@@ -78,8 +78,8 @@
         /// </summary>
         public event EventHandler<PostStatementEventArgs> PostInsert
         {
-            add { events.AddHandler(PostInsertEvent, value); }
-            remove { events.RemoveHandler(PostInsertEvent, value); }
+            add { events.AddHandler(PostInsertEventKey, value); }
+            remove { events.RemoveHandler(PostInsertEventKey, value); }
         }
 
         /// <summary>
@@ -87,8 +87,8 @@
         /// </summary>
         public event EventHandler<PostStatementEventArgs> PostSelect
         {
-            add { events.AddHandler(PostSelectEvent, value); }
-            remove { events.RemoveHandler(PostSelectEvent, value); }
+            add { events.AddHandler(PostSelectEventKey, value); }
+            remove { events.RemoveHandler(PostSelectEventKey, value); }
         }
 
         /// <summary>
@@ -96,8 +96,8 @@
         /// </summary>
         public event EventHandler<PostStatementEventArgs> PostUpdateOrDelete
         {
-            add { events.AddHandler(PostUpdateOrDeleteEvent, value); }
-            remove { events.RemoveHandler(PostUpdateOrDeleteEvent, value); }
+            add { events.AddHandler(PostUpdateOrDeleteEventKey, value); }
+            remove { events.RemoveHandler(PostUpdateOrDeleteEventKey, value); }
         }
 
         #endregion

Modified: 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Events/PostStatementEventArgs.cs
URL: 
http://svn.apache.org/viewvc/ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Events/PostStatementEventArgs.cs?rev=789034&r1=789033&r2=789034&view=diff
==============================================================================
--- 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Events/PostStatementEventArgs.cs
 (original)
+++ 
ibatis/branches/MappedStatementRefactor/Apache.Ibatis.DataMapper/Model/Events/PostStatementEventArgs.cs
 Sun Jun 28 02:12:00 2009
@@ -35,5 +35,10 @@
         /// </summary>
         /// <value>The result object.</value>
         public object ResultObject { get; set; }
+
+        /// <summary>
+        /// Was the ResultObject populated from cache?
+        /// </summary>
+        public bool CacheHit { get; set; }
     }
 }


Reply via email to