DomSqlMapBuilder


I was trying to use the IBatis Cache with procedures and it seems it's not implemented.
Spelunking thru the code I think I've found the problem.

On IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap the code that builds the Select statements creates a CachingStatement for that statement if it uses cache, but it doesn't do that for Procedure. It also doesn't do that for <statements> and the fix should be the same.

I'm not sure if this list accepts attachments, so I'm pasting the patch here.

Start of patch:
------------------------
Index: DomSqlMapBuilder.cs
===================================================================
--- DomSqlMapBuilder.cs (revision 469136)
+++ DomSqlMapBuilder.cs (working copy)
@@ -1383,7 +1383,12 @@
     // Build MappedStatement
     mappedStatement = new MappedStatement( _configScope.SqlMapper, procedure);
 
-    _configScope.SqlMapper.AddMappedStatement(mappedStatement.Id, mappedStatement);
+    IMappedStatement mapStatement = mappedStatement;
+                if (procedure.CacheModelName != null && procedure.CacheModelName.Length > 0 && _configScope.IsCacheModelsEnabled)
+                {
+                    mapStatement = new CachingStatement(mappedStatement);
+                }
+                _configScope.SqlMapper.AddMappedStatement(mappedStatement.Id, mapStatement);
    }
    #endregion
------------------------
End of patch

Best Regards,
Paulo Carreiro

Attachment: ProcedureCache.patch
Description: Binary data

Reply via email to